Consecutive Branches are invalid

From Liberty BASIC Family
Jump to navigation Jump to search

Description

Branch labels must head up a block of code, even a rem statement. If they don't and you list one [Branch Label] above another [Branch Label] Liberty will become confused when an event fires. It will appear to run normally from the IDE but if you run the code in debug or tokenise the code the error will show. This is a timer example but a button press event will display the same error.

Example code to demonstrate the bug.

[start]
[anotherlabel]
    for k=1 TO 10
        print k
    next
    timer 200,[start]
    wait

Example code to work around the bug.

[start]
    ' this simple rem statement solves the problem
[anotherlabel]
    for k=1 TO 10
        print k
    next
    timer 200,[start]
    wait