Variables, Constants, and Literal Strings

Comprehensive rules for variables, constants, and literal strings are contained in the Object REXX Reference. If you've programmed in Basic or C, you won't find anything too surprising about REXX's implementation.

You can name variables almost anything you want. REXX imposes few rules. A variable name can be any symbol (group of characters), containing up to 250 characters, with the following restrictions:

Literal strings in REXX are delimited by quotation marks (either ' or "). Examples of literal strings are:

'Hello'"Final result:"

If you need to use quotation marks within a literal string, use quotation marks of the other type to delimit the string. For example:

"Don't panic"
'He said, "Bother"'

There's another way to do this. Within a literal string, a pair of quotation marks (the same type that delimits the string) is interpreted as one of that type. For example:

'Don''t panic'                 (same as "Don't panic"      )
"He said, ""Bother"""          (same as 'He said, "Bother"')


[Back: Testing Your Program]
[Next: Assignments]