IonicWind Software

Aurora Compiler => General Discussion => Topic started by: kryton9 on August 09, 2006, 08:57:30 PM

Title: bug?
Post by: kryton9 on August 09, 2006, 08:57:30 PM
Don't know if this is a bug.

This gives an error in the else statement, that is having a commented line between the if and else statements

if x<0 AND y <0 {Result = 180-(180*atan(abs(x/y))/pi);}
//if x<0 AND y <0 {Result = 180-(180*atan(abs(x/y))/pi);}
else {Result = 180*atan(abs(x/y))/pi;}

Take the commented line out and it works:
if x<0 AND y <0 {Result = 180-(180*atan(abs(x/y))/pi);}
else {Result = 180*atan(abs(x/y))/pi;}

The above code is for a function I am working on to return a value in a 360 degree world from the direction vectors used by Aurora. I got half of it working, will get the rest tonight :)
Title: Re: bug?
Post by: Ionic Wind Support Team on August 09, 2006, 09:06:11 PM
Not really a bug.  The lexer, although ignoring comments, wasn't expecting an else at that point.  The braces are not needed as well.  Write like this and it will be easier for both of us to read ;)

if( x<0 AND y <0 )
  Result = 180-(180*atan(abs(x/y))/pi)
else
  Result = 180*atan(abs(x/y))/pi;


The lexer looks for certain character sequences such as

} <whitespace> else

Where whitespace can be any number of spaces tabs or newlines.  Putting a comment between the two isn't allowed currently.  It is something I can add though.

Title: Re: bug?
Post by: kryton9 on August 09, 2006, 10:51:10 PM
You know me, I hate braces, so I love hearing write without using them.
I find a lot of times I get errors if I don't put them in, so this way I play it safe :)

Do away with those pesky braces and save all our eyes :) By the way thanks for giving us an option not to use ( ) in if statements. The less I have to use stuff like that, that hurts my eyes the better :)
Title: Re: bug?
Post by: Kale on August 10, 2006, 02:16:14 AM
Quote from: kryton9 on August 09, 2006, 10:51:10 PM
You know me, I hate braces, so I love hearing write without using them.
I find a lot of times I get errors if I don't put them in, so this way I play it safe :)

Do away with those pesky braces and save all our eyes :) By the way thanks for giving us an option not to use ( ) in if statements. The less I have to use stuff like that, that hurts my eyes the better :)

No, no, no. Braces and parenthesis help code readability. Don't take them out of the language please. :o
Title: Re: bug?
Post by: kryton9 on August 10, 2006, 08:48:35 AM
Don't worry Kale, this discussion we had before... they are in for good and I understand why, just having fun.