LB Booster
Programming >> Compatibility with LB4 >> nested single-line IF
http://lbb.conforums.com/index.cgi?board=compatibility&action=display&num=1389217862

nested single-line IF
Post by tsh73 on Jan 8th, 2014, 8:51pm

Just found. Pretty sure it's rather dark corner (I would never writhe this), but I leave it to you to decide if it's an LB bug or what.
Code:
print "conventional nested if then else if then else"

for x = 0 to 1
    for y = 0 to 1
    print x;" ";y;" ";
        if x then print 1 else if y then print 2 else print 3
    next
next

print "now, if if then else (?)"
for x = 0 to 1
    for y = 0 to 1
    print x;" ";y;" ";
        if x then if y then print 2 else print 3
    next
next
 

LB/JB:
Code:
conventional nested if then else if then else
0 0 3
0 1 2
1 0 1
1 1 1
now, if if then else (?)
0 0 3
0 1 3
1 0 1 1 2
 

LBB 2.40:
Code:
conventional nested if then else if then else
0 0 3
0 1 2
1 0 1
1 1 1
now, if if then else (?)
0 0 3
0 1 3
1 0 3
1 1 2
 

Re: nested single-line IF
Post by Richard Russell on Jan 8th, 2014, 9:09pm

on Jan 8th, 2014, 8:51pm, tsh73 wrote:
Just found. Pretty sure it's rather dark corner (I would never writhe this), but I leave it to you to decide if it's an LB bug or what.

It's documented:

"10. In a single-line IF statement LBB may behave differently from LB4 if there are multiple (cascaded) IFs and an ELSE clause. To resolve this recast the code as nested multi-line IFs":

http://www.lbbooster.com/lbb.html#compatibility

Since this is a known and documented incompatibility, I'm not too sure what the purpose of your report is. There's no easy way in which I can make LBB work the same as LB in this respect - if there was I would already have done it!

It is not my ambition to make LBB 100% compatible with LB: it is neither possible nor desirable! That's why I said in another thread that two large commercial applications had been ported to LBB; a few minor adjustments to the code were necessary (in most, if not all, cases compatibility with LB 4.04 was retained).

Richard.

Re: nested single-line IF
Post by tsh73 on Jan 9th, 2014, 04:29am

>>Since this is a known and documented incompatibility, I'm not too sure what the purpose of your report is.

Simple: I honestly read "incompatibility list" more then once, but this thing did not stick to my brain.
Likely because I never use nested single-line IFs.

So my fault actually.