|Command||basic.statements Definition/BASIC Program
Applicable release versions: AP, R83
|Category||BASIC Program (486)|
|Description||differences between statements and functions in Pick/BASIC, a working definition of variable, constant, labels, blanks, and program formatting.
If the syntax requires that the instruction be followed by a set of parentheses (optionally containing an argument or arguments), then it is a function. For example, the following are functions: "abs(num.expression)", "rnd(num.expression)" and "iconv(string.expression, conv.expression)".
Any instruction that does not have to be followed by a set of parentheses is most often a statement. For example: "print x", "input y", "execute sentence".
There is at least one peculiar exception to the above rule. One variant of the "locate" statement is considered a statement, even though its syntax looks like it should be a function.
Another feature of statements is that they tend to "stand alone". For instance: "execute sentence" or "print array<10,1>".
Functions, by contrast, do not stand alone. They are either used as part of an expression within a statement: "raise = rnd(20)", or output immediately: "crt int(amount)", "print abs(balance)".
A Pick/BASIC program is composed of statements made up of Pick/BASIC commands, variables, constants, expressions, and functions.
Pick/BASIC statements may contain arithmetic, relational, and logical expressions. These expressions are formed by combining specific operators with variables, constants, or Pick/BASIC intrinsic functions.
The value of a variable may change dynamically throughout the execution of a program. A constant, as its name implies, has the same value throughout the execution of a program.
An intrinsic function performs a pre-defined operation on the supplied parameter(s).
Normally, within a Pick/BASIC program, each physical line contains only one statement. This is done for ease of reading and tracking of logic.
More than one statement may be placed on a program line by separating each statement with a ";" (semicolon). Statements which end with "then" or "else" on a line create a block or multi-line structure. See the "if" statement for details on "then...else" statements.
Labels may be placed at the beginning of any Pick/BASIC statement. A statement label may be numeric or alphanumeric. See "statement labels".
Blank spaces appearing in the program line which are not part of a literal are ignored. Blank spaces and blank lines may be used freely within the program for purposes of appearance. (AP only -- R83 does not support blank source lines).