brackets
    Richard Gaskin 
    ambassador at FourthWorld.com
       
    Thu Jan 17 18:59:01 EST 2002
    
    
  
erik hansen wrote:
> i have to rescind my promise not to ask questions
> until completing all tutorials. the MC
> "application tutorial" is completed, the first
> HyperActive tutorial in progress.
> 
> i like to use lots of brackets:
> put (the number of items in it) into tot
> a few stabs in the msg yielded unexpected
> results.
> is there a topic heading in MC help that
> addresses this?
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.
-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 1.9: Publish your database on the Web
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc
    
    
More information about the metacard
mailing list