aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - iziBasic - Topic #1454

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1454  IF/THEN/ELSE behavior - finally figured it out

23/09/2006 @ 23:02
by Dave O\'Brien

Anonymous



FYI, I just figured out what was causing a frustrating bug in my program.

I was using code like this:

IF A=B
'do something
ELSE
'do something else
ENDIF

It compiled just fine, but didn't work.

Took me a long while to realize I was missing the THEN keyword. As soon as I put that in, it worked properly.

In a future release of iziBasic, perhaps it would be useful to either:
- make the THEN optional in IF/ELSE statements (like it is for IF statements without the ELSE), or
- keep the THEN required, but generate a syntax error at compile time.

Thoughts?
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
--------
24/09/2006 @ 18:20
by aldweb

Anonymous

visitor
Hello Dave,

You are right, the checks performed by the compiler are not 100% efficient with the IF statement and someone can get the bad side effect you got. It is then difficult to find back where the mistake is. I will have to enhance the iziBasic syntax checker in this area for the next release.

What you got as a side effect is because of the 2 syntaxes allowed for the IF statement:
IF A=B Statement
and :
IF A=B THEN Statement
[ELSE Statement]
ENDIF


The first syntax is equivalent to the second one expressed this way:
IF A=B Statement : ENDIF

In your code, this is how iziBasic interpreted it:
IF A=B : ENDIF
ELSE Statement
ENDIF

Of course this has no chance to work!

Thanks for reporting, I'll work it for next iziBasic version.

Cheers,


@+
aldweb
Write to aldweb   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^