SET

Top  Previous  Next

 

The SET command sets a value into an @-variable.

 

 

Format

 

SET variable  value

SET variable EVAL expression

 

where

 

variableis the name of the variable to be set. The leading @ character is optional. The name may be up to 32 characters and is case insensitive.

 

valueis the value to be stored. This may not include the mark characters.

 

expressionis an arithmetic expression to be evaluated.

 

 

The SET command sets a value into a user defined @-variable. The values of system defined variables @SYSTEM.RETURN.CODE, @USER0 to @USER4 and @USER.RETURN.CODE can also be set.

 

In the second form, the expression may include the four arithmetic operators +,  -, * and /. These operators must be surrounded by spaces. Any @-variables in the expression will be expanded.

 

 

Examples

 

SET USER.RETURN.CODE 1

 

The above command sets the @USER.RETURN.CODE variable to 1.

 

 

PA

SET CT 5

LOOP

  DISPLAY <<@CT>>

  SET CT EVAL @CT - 1

  IF @CT = 0 THEN STOP

REPEAT

 

This paragraph executes the loop five times, displaying the decreasing values stored in @CT on each cycle.

 

 

See also:

LIST.VARS and the QMBasic !ATVAR() and !SETVAR() subroutines.