View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default Parenthesis - to use or not to use?

Greetings all

Quick question - In John Green et al's Excel 2000 VBA I find the
following assertion: "The general rule is that if you want to capture
the return value of a function, you need to put any argument in
parenthesis. If you don't want to use the return value, you should not
use parenthesis."

The first sentence is of course a nonnegotiable point of syntax - but
what about the second sentence? I was under the impression that it is
100% a matter of taste if I write msgbox "Hello world" or
msgbox("Hello world"), but the word "should" above suggests that there
is a principled reason to drop parenthesis if not needed. Is there? In
particular, does the computer in some sense process a non-returned
value if you include parenthesis but not otherwise, so that a small
performance hit attaches itself to parenthesis? Also, what about sub
calls when there is no return value to worry about?
If it is just a matter of taste I'll stick to parenthesis since it
seems somehow more logical to me.

Thank you for your time.

-John Coleman