Assignment statements

Variable values are set and changed using assignments. The assignment not only sets the value of a variable, it also sets the data type.

A variable is considered an array if it is followed by a numeric index in square brackets. Arrays automatically expand to hold all elements assigned to them.

Syntax

    variable-name = expression;

or for arrays:

    variable-name[numeric-expression] = expression;

Example

    age = 12;

or

    name[1] = "Donald";