If a program begins with a local variable structure and has a program as the defining procedure, the complete
program acts like a user-defined function in two ways: it takes numeric or symbolic arguments, and takes those
arguments either from the stack or in algebraic syntax. However, it does not have a derivative. (The defining
program must, like algebraic defining procedures, return only one result to the stack.)
There's an advantage to using a program as the defining procedure for a local variable structure: The program
can contain commands not allowed in algebraic expressions. For example, loop structures are not allowed in
Using Tests and Conditional Structures
You can use commands and branching structures that let programs ask questions and make decisions.
Comparison functions and logical functions test whether or not specified conditions exist. Conditional
structures and conditional commands use test results to make decisions.
A test is an algebraic or a command sequence that returns a test result to the stack. A test result is either true —
indicated by a value of 1. — or it is false — indicated by a value of 0..
To include a test in a program:
To use stack syntax, enter the two arguments, then enter the test command.
To use algebraic syntax, enter the test expression (with ' delimiters).
You often use test results in conditional structures to determine which clause of the structure to execute.
Conditional structures are described under Using Conditional Structures and Commands, p.1-13.
Test whether or not X is less than Y. To use stack syntax, enter X Y <. To use algebraic syntax,
enter 'X<Y'. (For both cases, if X contains 5 and Y contains 10, then the test is true and 1. is returned to the
Using Comparison Functions
Comparison functions compare two objects, using either stack syntax or algebraic syntax.
„° %TEST% (pages 1 and 2):
Tests equality of two objects.
Less than or equal to.
Greater than or equal to.
Identical. Like = =, but doesn't allow a
comparison between the numerical value of
an algebraic (or name) and a number. Also
considers the wordsize of a binary integer.
RPL Programming 1-11