Next: Graphics, Previous: Expressions, Up: Top [Contents][Index]
A computer program in the LUX language is a set of statements, which are executed in the order in which they are encountered. Statements execute commands and control the flow of execution. Statements usually involve expressions and may contain other statements.
LUX offers many statements. The assignment and insertion statements
allow storage of data in variables. The if
, case
, and
ncase
statements allow branching, i.e., execution of
statements depending on one or more conditions. The for
,
repeat
, WHILE-DO
, and DO-WHILE
statements allow
loops, i.e., repetition of statements. A block statement allows
a set of statements to be treated as a single one. The block routine
(block
), subroutine (subr
), and function (func
)
definition statements allow definition of routines written in the LUX
language. Block routine and subroutine calls allow these user-defined
routines to be used. The jump statements break
, continue
,
retall
, and return
allow (restricted) forced exit from
loops and routines. File inclusion statements (@
and
@@
) allow the contents of a file to be read and executed.
In the formal description of the syntax of these statements, square
brackets []
enclose optional parts, and dots … indicate
that the preceding phrase may be repeated.
• Assignment: | Assignment statements | |
• IF Statement: | Select based on a condition | |
• CASE Statement: | Select based on a value | |
• NCASE Statement: | Select based on conditions | |
• FOR Statement: | Repeat a fixed number of times | |
• REPEAT Statement: | Repeat until a final condition is met | |
• WHILE-DO Statement: | Repeat while an initial condition is met | |
• DO-WHILE Statement: | Repeat while a final condition is met | |
• Block Statement: | Treat a group of statements as one | |
• Block Routine Definition: | Name a group of statements | |
• Block Routine Execution: | How to execute a named group of statements | |
• Subroutine Definition: | Define a subroutine | |
• Subroutine Call: | How to use a subroutine | |
• Extended Parameter Lists: | Arbitrary numbers of arguments | |
• Function Definition: | Define a function | |
• Jumps: | Forced jumps to other statements | |
• File Inclusion: | Reading commands from a file | |
• Ignoring Input: | How to make LUX ignore input | |
• Line Breaks: | How LUX treats line breaks |
Next: Graphics, Previous: Expressions, Up: Top [Contents][Index]