Suggestion for correcting the IDE's script editor

SimPLsol at aol.com SimPLsol at aol.com
Tue Jun 28 17:55:11 EDT 2005


In a message dated 6/28/05 2:25:02 PM, see3d at writeme.com writes:

if a then
     if b then get c else get d
else
     doSomethingElse
end if

It generates:

if a then
     if b then get c else get d
     else
     doSomethingElse
     end if

I get the same response (OS X 10.4.1, Rev 2.5.1) however this formats 
properly:

if a 
then
      if b 
     then get c 
     else get d
else
     doSomethingElse
end if

We could argue all month about style but, for the benefit of anyone 
interested, here's how I do it:

if [short statement] then [short statement]

if [long statement]
then [long statement]

if [statement]
then
     [multiple statement #1]
     [multiple statement #2]
     [additional statements]
end if

if [statement]
then
     [one or more statements]
else
     [one or more statements]
end if

Like it or not, it is consistent, it is easy to read, and it formats 
correctly. Putting "then" under "if", instead of after it, really helps readability 
with nested repeats - like Dennis' example.
Paul Looney



More information about the use-livecode mailing list