LB Booster
« SELECT CASE oddity »

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



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: SELECT CASE oddity  (Read 321 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx SELECT CASE oddity
« Thread started on: Jun 4th, 2014, 10:49pm »

The documented syntax for SELECT CASE is:

Code:
SELECT CASE var
  CASE x
    ' code goes here
  CASE y
    ' code goes here
  CASE ELSE
    ' code goes here
END SELECT 

But what happens if you insert some code before the first CASE, like this:

Code:
SELECT CASE var
    ' spurious code here
  CASE x
    ' code goes here
  CASE y
    ' code goes here
  CASE ELSE
    ' code goes here
END SELECT 

It turns out that neither LB 4.04 nor LBB reports an error in this situation but they behave differently! In LB the spurious code is always executed and in LBB it is never executed (irrespective of the value of var).

So if (presumably by mistake) you do this it will probably result in an incompatibility.

Richard.
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