A curious case
tsj at unimelb.edu.au
Tue Mar 1 19:48:27 EST 2011
Bob - as you've found out, nested if/then statements tend to break down in
unexpected ways when you mix the short and long forms of the syntax. To be
on the safe side, always opt for the long form when nesting statements -
these always compile correctly.
On 2/03/11 11:40 AM, "Bob Sneidar" <bobs at twft.com> wrote:
> Hi all.
> I just came across a curious issue where I had an if then else control
> structure inside another if then structure.
> I *thought* I used toe be able to use the form
> if statement then
> -- do somestuff
> else if anotherstatement then
> -- do someotherstuff
> -- do defaultstuff
> end if
> When I nested this inside another if then else control structure it told me I
> was missing an end if! However if I converted the above structure to a switch
> control structure the script compiled fine. Have I stumbled upon something
> here? It kind of makes sense to me because the compiler may be having trouble
> knowing which control structure *else if anotherstatement* belongs to.
> This is not a problem per se, but I am just curious and it may help someone
> else who encounters it in the future to not spend an hour or two poring over
> code that is technically correct but won't compile.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne
More information about the use-livecode