basic.assignment

Definition/BASIC Program, Releases: AP and R83

Assigns value to variable.

Syntax

variable = expression

Description

value of an expression to a variable.

The variable can be a simple variable, an array element, a dynamic array element, a substring, or all of the above.

Example

name = 'george'

The variable 'name' is assigned the string 'george'.

result = (unit.price * qty)

The variable 'result' is assigned to the result of the arithmetic
expression.

line = result: ' is the answer'

The variable 'line' is assigned the result of the string expression.

item<-1> = code

Adds the value of 'code' as the last attribute of the dynamic array
'item'.

item<codes,-1> = code

Adds the value of 'code' as the last value in an attribute of codes.

customer.array(5) = 'fred'

The value, 'fred', is assigned to the fifth element of the
dimensioned array, 'customer.array'.

item<1,2,2> = '100'

The second subvalue in the second value in the first attribute of the string in
'item' is replaces with the string '100'.

string[3,2] = 'ca'

Character positions 3 and 4 of 'string' are replaced with the string
'ca'.

item<1,2,1>[3,2] = 'ca'

The 3rd and 4th character positions of the string found in the first subvalue
in the second value in the first attribute of 'item' is replaced with
the string 'ca'.

See Also

Command Name Type Description
basic.let Statement Optional assignment indicator.
basic.substring.expressions Definition Extracts from, or assigns to, a substring.
basic.array.dynamic Definition A string variable delimited by reserved metacharacters.
basic.array.dimensioned Definition a table where the contents of the elements can be altered (replaced) but the position of each element is fixed.
basic.array.references Definition Referencing arrays.
arrays.relational.expressions Definition Description of array handling.
basic.clear Statement Initializes all variables.
basic.dim Statement Declares a dimensioned array.
basic.equate Statement Declares constants at compile time.
basic.assigned Function Determines if variable has been assigned a value.
basic.nuclear.tokens Definition Any function or expression may itself be an argument of another function or expression. The compiler evaluates expressions starting with the innermost set of parentheses.
data.representation Definition two types of data: numeric and string.
array Definition tables of values of any data type.
basic.substring.assignment Definition Assigns to a substring.
basic.substring.field.store Definition Assigns to a substring.
basic.substring.extraction Definition Extracts from a substring.
basic.mat Statement Assigns data to a dimensioned array.
basic.: Relational Operator Concatenation operator.
basic.= Assignment Operator Logical 'equal' operator or variable assignment.
basic.*= Assignment Operator Multiplies numeric expression and assigns to variable.

User Comments

What do you think?

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

Login to leave your comments.