brackets

erik hansen erikhans08 at yahoo.com
Thu Jan 17 19:25:01 EST 2002


parentheses! curly brackets!
this was once a topic.

for me, clarity is the issue, esp. with a long
line. logical evaluations too: 
if (a=b) and (c<>d) then...

i just wondered if MetaCard had some quirks...

--- Richard Gaskin <ambassador at fourthworld.com>
wrote:
> Not that I'm aware of, but prudent use of
> parentheses can help make code
> more readable, and sometimes help
> interpretation by the engine.
> 
> Start with the discussion of operators and
> their order of precedence.  It's
> in such cases that it'll be more critical.
> 
> Beyond that, think of parens as a way of
> removing ambiguity.  For example,
> if you write:
> 
>    put 12 * 4 + 1 into tMyVar
> 
> Do you mean:
> 
>    put (12 * 4) + 1 into tMyVar
> 
> or do you mean:
> 
>    put 12 * (4 + 1) into tMyVar
> 
> In some cases parens have an effect on string
> concatenation as well, so I
> try to put them around expressions I want
> evaluated prior to concatenation:
> 
>    put the number of this cd + 1
> 
> is less clear than:
> 
>    put (the number of this cd) + 1
> 
> In this particular cases, I don't think the
> interpreter would get confused,
> but it sure makes it easier to skim the code.


=====
erik at erikhansen.org                 http://www.erikhansen.org

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/



More information about the metacard mailing list