11.07.2015 Views

BCL Programmers Manual V2.00 (PDF) - Barix

BCL Programmers Manual V2.00 (PDF) - Barix

BCL Programmers Manual V2.00 (PDF) - Barix

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FOR i=1 TO 10if ... THEN NEXT i...NEXT i' ILLEGAL !!! - use GOTO insteadNote: V can be modified in the loop, which can be used for early loop termination.Note: The programmer is strongly discouraged from using GOTO to jump into FOR..NEXTloops. Jumping out of the loops using GOTO is possible. Another way to leave aFOR..NEXT loop is to set the loop variable to E2.Nested FOR loops are allowed but correct order of FOR and NEXT must be kept:FOR A=1 TO 10FOR B=1 TO 10...NEXT A' This is WRONG!NEXT BFOR A=1 TO 10FOR B=1 TO 10...NEXT BNEXT A' This is CORRECT6.4 SubroutinesGOSUB L...L .......RETURN [L1]When a GOSUB is found the interpreter remembers the actual code position and startsinterpreting with the statement at line/label L.When a RETURN command is found the execution is resumed at the first statement after thecalling GOSUB instruction. If optional parameter L1 is used the execution is resumed at lineL1. Only lines to which GOTO jump from the original return point would be allowed can beused for L1.WARNING: The use of the GOTO statement to jump into or out of a sub-routine isprohibited!To end a subroutine, the RETURN command must be used, otherwise the calling stack of theinterpreter is not cleared which may result in a stack overflow and a program termination withan error message.6.5 Conditional statementsCondition evaluation and code branching are possible using the IF statement.IF is followed by a boolean or integer expression:If the logical expression is true or the integer result is non-zero the commands following theTHEN statement are executed. Two syntax forms of the IF statement exist:6.5.1 Multiline IFIf the expression is true and THEN is the last statement on the line (excluding comments), amultiline IF statement is assumed and all following lines up to the first unmatched ELSE orENDIF statement are executed.<strong>Barix</strong> AG | 21/106

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!