I've been digging through a large portion of the samples available all weekend, trying to get a better feel for the way different tasks are approached with Aurora. Up until this morning I continued to have the feeling that something was missing, yet I couldn't quite put my finger on it.
Finally figured out what it was... the lack of an "ENDIF" in the code.
Since the samples all compile and work, I have to assume that the "endif" is somehow implied in the code structure, and would like to have a better understanding of how that works. Sure feels strange.
Note - This has bound to have been detailed somewhere here on the forum, but I've yet to find it through the search features. If someone can kindly point me to correct thread, I'd appreciate it.
-Doc-
All languages that use braces control the context on the ending brace.
if a = b
{
do somethkng
} //end of the IF
While a < 10
{
a++;
} //end of the while statement
besides being cleaner it allows for more advanced structure than you cna get with BASIC languages. There are many 'styles' of indenting and positiong of the braces. And while Aurora doesn't require parentheses on a simple if statment they can make it more readable.
if (a = 10) {
do something
do somethng more
} //end of the if clause.
Single line IF statements are supported, as are "else if" statements
if (b = "hello") writeln("hello") else writeln("goodbye");
since all lines are terminated by a semicolon, and not the newline character yoou can format the above to your liking.
if (b = "hello")
writeln("hello")
else
writeln("goodbye");
And the aforementioned else if clause:
if (a = 10)
{
...
}
else if (a=20)
{
....
}
else if (a= 30)
{
....
}
else
{
...
}
Paul.
Perfect! ...exactly what I needed and much appreciated.
Coming from a history of using "basic-like" languages, it wasn't clear how or exactly where the blocks were ending.
-Doc-
After some additional consideration and testing...
...all I can say is that I'm starting to really appreciate this language! The added flexibility is just awesome! ;D
-Doc-
One last thing to add here... I finally ran across the original discussion concerning IF/EndIf, which I **should** have remembered! ::)
Here's the thread:
http://www.ionicwind.com/forums/index.php?topic=3.0
-Doc-