pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
INT c := 3, ! Value to scan for in s
z := -1; ! Value to stop the scan?
SCAN s UNTIL c -> t_start; ! Scan s for c and store c's
! address in t_start
t_start := t_start '+' 1; ! Skip character in c
SCAN s[t_start '-' @s]
UNTIL z -> t_end; ! Find end of message
USE
The USE statement creates a temporary variable.
identifier
is the name of the temporary variable being created.
A temporary variable that the USE statement creates:
• Is equivalent to a variable declared INT
• Is usually kept in a register
• Exists until either:
You drop it with the statement DROP (page 212) (recommended)◦
◦ The procedure that creates it ends
WHILE
The WHILE statement is a pretest loop that repeatedly executes a statement while a specified
condition is true.
condition
is either:
• A conditional expression
• An INT, INT(32), or FIXED arithmetic expression. If the result of the arithmetic expression
is not 0, condition is true. If the result is 0, condition is false.
statement
is any pTAL statement.
The WHILE statement tests the condition before each iteration of the loop. If the condition
is false before the first iteration, the loop never executes.
Hardware indicators cannot appear in the conditional expression of a WHILE statement.
232 Statements