PDA

View Full Version : [SOLVED] Call Function



sheeeng
06-20-2005, 09:39 PM
Can anyone :hi: tell the difference between


Call Msgbox

and


Msgbox

?

Thanks. :yes

I'm not bery clear on that. :doh:

Jacob Hilderbrand
06-20-2005, 10:01 PM
You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist. If you use either Call syntax to call any intrinsic or user-defined function, the function's return value is discarded.

To pass a whole array to a procedure, use the array name followed by empty parentheses.

Just two ways to do the same thing.

Like:

2-1

Vs.

-1+2

You can omit the + in the first example, but not in the second.

Bob Phillips
06-21-2005, 02:00 AM
Can anyone :hi: tell the difference between


Call Msgbox

and


Msgbox



There is no functional difference, but there are two style/usage considerations.

It forces you to put the arguments in parentheses, so this is more consistent with using functions that return a result. And it also clearly identifies procedure calls within the code, which can be useful when re-visiting the code.

MWE
06-21-2005, 10:25 AM
There is no functional difference, but there are two style/usage considerations.

It forces you to put the arguments in parentheses, so this is more consistent with using functions that return a result. And it also clearly identifies procedure calls within the code, which can be useful when re-visiting the code.
I second xld's thoughts here.

FYI to Sheeeng: as you are probably aware, MsgBox can also be used to return a value, for example


Ans = Msgbox(...)

sheeeng
06-22-2005, 02:16 AM
Thanks. All clear here for me.

Terima Kasih!
("Thank you" in Malaysian Language)