A curious case

dunbarx at aol.com dunbarx at aol.com
Tue Mar 1 22:29:55 EST 2011


This goes way back to the earliest HC days. You can even find cases where indentation doesn't even work, never mind successful compiles, even though the construction is sound. I seem to remember that in HC,  it happened both ways with mixed constructs as well, that failed indentations worked, and that properly indented structures did not.


Craig Newman


-----Original Message-----
From: Terry Judd <tsj at unimelb.edu.au>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Mar 1, 2011 7:48 pm
Subject: Re: A curious case


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.

Terry...


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
> else
>     -- 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.
> 
> Bob
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne



_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list