Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Basic - <b>if conditional branch</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
IF                       Conditional Branch

 1. Block syntax

 IF expression THEN
   statement1
   [statement2]
   .
   .
   .
 [ELSEIF expression THEN
   statement10
   [statement11]
   .
   .
   .
 [ELSE
   statement15
   [statement16]]
   .
   .
   .
 [EXIT IF]
 ENDIF


 2. Single-line syntax

 IF expression THEN statement1 [ELSE statement2]

    Causes Turbo Basic to make a decision based on the value of an
    expression.

  expression    An integer expression; 0 is equivalent to FALSE, while all
                other values are equivalent to TRUE.

   statement    Any legal statement. The single-line mode's statement can
                be just a line number or line label. This is equivalent to
                a GOTO statement with the specified label.

   -------------------------------------------------------------------------

      Notes:    Each expression in the IF/ELSEIF construct is tested in
                order. As soon as an expression is found to be TRUE, its
                corresponding statements are executed. If no expressions
                are TRUE, the statements following the ELSE keyword are
                executed. If ELSE is not specified, execution continues
                with the statement following the ENDIF or the single-line
                IF statement.

                The only difference between Turbo Basic's one-line
                construct and that of interpreted BASIC is that Turbo
                Basic allows the use of labels as well as numbered lines.

                In the block construct, the following rules apply:

                    IF, ELSE, ELSEIF, and ENDIF must all be the first
                    keywords on their respective lines.

                    THEN must be the last keyword on its line; if anything
                    other than a comment follows on the same line with
                    THEN, Turbo Basic thinks it's reading a single-line
                    IF/THEN/ELSE construct.

                IF blocks may be nested.

                Do not put a colon before the ELSE keyword.

See Also: ON...GOTO ON...GOSUB SELECT

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson