Conditional Expression

From BR Wiki
Revision as of 00:10, 8 February 2013 by Laura (talk | contribs) (Created page with "The "cond-expr" parameter is used mainly in IF statements and SKIP commands, although it is also one type of numeric expression. The cond-expr is a comparison of value...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The "cond-expr" parameter is used mainly in IF statements and SKIP commands, although it is also one type of numeric expression. The cond-expr is a comparison of values using one of the following comparison operators (a statement such as IF A THEN GOTO 100 contains an implied comparison of IF A<>0):

<>, ><' Not equal to
~= Not equal to
<=, =< Less than or equal to
>=, => Greater than or equal to
==, = Equal to
> Greater than
< Less than
~ Not
~= Not equal to

AND, OR and NOT may also be used. The use of the colon-equal (:=) symbol to indicate assignment may be unfamiliar to many programmers. Use of this symbol can help reduce program space in some instances. For example, the first of the following statements (using the colon-equal assignment operator) is equivalent to the two statements, which follow it:

00010 PRINT STR$(L:=L+1)
00020 LET L=L+1
00030 PRINT STR$(L)

Business Rules evaluates all conditional expressions to a value of nonzero (true) or zero (false). A true evaluation leads to the THEN action in an IF statement or causes the SKIP action to occur in a SKIP command. A false evaluation leads to the ELSE action in IF statements or prevents the SKIP action from occurring.

See the IF statement for more information.