June 24, 2024, 06:05:06 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


bug?

Started by kryton9, August 09, 2006, 08:57:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kryton9

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 :)

Ionic Wind Support Team

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.

Ionic Wind Support Team

kryton9

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 :)

Kale

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

kryton9

Don't worry Kale, this discussion we had before... they are in for good and I understand why, just having fun.