Labels

Wednesday 1 January 2014

Variables in REXX

There is no variable declaration in REXX. Varaibles are declared on the fly the first time it appear in a statement.

For Example, consider the below program.

/* REXX */

Say A
A = Hello World
Say A

Say A Statement in above code behaves differently.

First 'Say A' displays 'A' as 'A' doesn't contain any value.

Second 'Say A' displays as 'Hello World' as 'A' contains 'Hello World'.

THE RULES FOR VARIABLE NAMES ARE
FIRST CHARACTER NOT 0-9 OR PERIOD.
REMAINING CHARACTERS ANYTHING EXCEPT BLANK.
CAN BE 250 CHARACTERS LONG
UPPER AND LOWER CASE CHARACTERS ASSUMED BE THE
SAME.

VARIABLES CAN ASSIGN THE VALUE USING SIMPLE
ASSIGNMENT STATEMENT OF THE FORM

<VARIABLE> = EXPRESSION

Variables can be used in arithmetic expression if they contain valid numeric value.

No comments:

Post a Comment