2

This is a syntax question. I am confused as to when the "return variable" in a Function is used as a return variable or as a method call. For instance, if I have:

Function foo() As Boolean
     foo = True
     foo = foo And bar
End Function

Does the second line in this function act as a recursive call to foo, or does it resolve to true from the previous assignment?

1 Answer 1

3

To get the value as of the last assignment:

foo = foo And bar

To make a recursive call:

foo = foo() And bar

The () makes all the difference. (BTW, this applies to VBA too.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.