IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Haim on May 31, 2006, 01:22:33 PM

Title: GOTO Label...
Post by: Haim on May 31, 2006, 01:22:33 PM
I saw that Aurora recognizes goto and label.
Can anyone show me how to declare a label, and use it with goto?
Sorry to bother with such a low-tech question, but I'm curious.  :)

Haim
Title: Re: GOTO Label...
Post by: Mike Stefanik on May 31, 2006, 01:30:14 PM
The goto statement is the mark of the devil. So put Satan behind you and just say "NO" to the cloud of utter doom and darkness that it portends! Otherwise, you and your program will be consorting with the unclean demonkind known as "spaghetti code".

Paul would never do it, but every time the compiler encounters a goto statement, it should emit a warning and play the sound of a woman screaming in terror.
Title: Re: GOTO Label...
Post by: Ionic Wind Support Team on May 31, 2006, 02:40:15 PM
There are very few uses for a goto.  But in Aurora you can just define a label and then jump to it.

goto mylabel;
...

mylabel:

I left it in Aurora's syntax for consistancy with other languages.
Title: Re: GOTO Label...
Post by: Parker on May 31, 2006, 03:34:53 PM
Also, labels with the colon can only be declared when it is alone on the line (not even whitespace), but you can use the LABEL keyword, or the #emit keyword. The following three statements are equivalent.
theLabel:
    label theLabel;
#emit theLabel :
Title: Re: GOTO Label...
Post by: Haim on May 31, 2006, 10:43:35 PM
Thanks to all responders.
I am well aware of the devil lurking behind goto, still I was curious to see how it was implemented in aurora.
I promise to behave  ;)