LB Booster
IDE and Compiler >> Compiler >> If Them w/o compiler error
http://lbb.conforums.com/index.cgi?board=compiler&action=display&num=1393166596

If Them w/o compiler error
Post by FBack on Feb 23rd, 2014, 1:43pm

Yesterday I made an syntax error in 'If Then' command, instead 'Then', I wrote 'Them' I overlooked this error and I just only compile the program.

Compiling without error, but program is not working correct. What is wrong? Simple Typo!

Example:

Code:
StringVar$ = "1"
AnotherString$ = "3"
if StringVar$ = "1" theM AnotherString$ = "2" else AnotherString$ = "1"
print AnotherString$ 


Produce 3, which is wrong, it should be 2

But if 'If Then' statement' is not true (the some problem exist with numeric variables), this code work

Example:

Code:
StringVar$ = "2"
AnotherString$ = "3"
if StringVar$ = "1" theM AnotherString$ = "2" else AnotherString$ = "1"
print AnotherString$ 


Produce 1

The same error I noticed in LBB version 1.84, 2.40 and 2.43
Re: If Them w/o compiler error
Post by Richard Russell on Feb 23rd, 2014, 2:17pm

on Feb 23rd, 2014, 1:43pm, FBack wrote:
Compiling without error, but program is not working correct. What is wrong? Simple Typo!

When LBB was originally written, the assumption was that you would always test and debug the program in Liberty BASIC first (that's why it's called LB Booster!). For that reason LBB does very little syntax checking itself: it expects the program already to be 'correct'.

If you work only with LBB, rather than first testing your program with LB, the lack of syntax checking can be an issue, as you have found. I'll see if there's a simple change which would flag that specific typo as an error, but adding extensive syntax checking would be a lot of work.

Edit: I have made a change so that the next release of LBB will flag that, and similar, typos as an error.

Richard.

Re: If Them w/o compiler error
Post by FBack on Feb 23rd, 2014, 6:24pm

It's true, my mistake, I should first check the code in JustBasic.

The only problem is that, you wrote so convenient compiler and I'm regularly forgetting to do it.