arrays.relational.expressions

Definition/BASIC Program, Releases: AP and R83

Description of array handling.

Description

a brief discussion of referencing arrays in Pick/BASIC and the use of the special 'wildcard' array searching character.

Individual elements of dimensioned and dynamic arrays are compared in relational expressions using the standard syntax. All elements of the array can be compared to a specified value by using an '*' (asterisk) to identify the element.

In multi-dimensioned arrays, one or more dimensions can be specified using the example. When the asterisk is used, the operators '<', '>', '=', '<=', '>=' and '#' return a true value if at least one element of the array satisfies the relation. The asterisk may be specified only in relational expressions and only in one array expression in a statement.

Example

dim a(10)
if a(*) = 'x' then ....

This compares all elements in the dimensioned array 'a' to the value
'x'. If any element equals 'x', the 'then'
statement is performed.

if s<*> >= '10' then....

Checks that any element in the dynmaic array 's' is greater-than or
equal to '10'.

dim a(10,10)
if a(*,*)<*,*,*> = 'x' then....

Checks every attribute, value, and subvalue in every string in the dimensioned
array 'a'.

See Also

Command Name Type Description
basic.dim Statement Declares a dimensioned array.
basic.assignment Definition Assigns value to variable.
basic.array.variable Definition References a dimensioned array.
basic.*.wildcard Relational Operator Wildcard array reference.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.