LB Booster
« nested single-line IF »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:53am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: nested single-line IF  (Read 426 times)
tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx nested single-line IF
« Thread started 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
 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: nested single-line IF
« Reply #1 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.
User IP Logged

tsh73
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: nested single-line IF
« Reply #2 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.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls