Built-in and External Functions
Let’s get back to the example script. This line generates a random number between 1 and 5 inclusive. It places that value into the variable named the_number:
the_number = random(1,5) /* generate the random number */
This code uses the built-in function random to generate the random number. In one of its very few syntax requirements, Rexx requires that you code the left parenthesis immediately after the function name (without any intervening space). If the function has no input arguments, code empty parentheses like this:
the_number = random() /* generate a random number */
Much of the power of Rexx resides in its 70-odd built-in functions. The functions are categorized into these groups:
- String manipulation (for character, bit, and hex strings)
Many Rexx add-ons and tools come in the form of external function libraries, or packages with additional functions. Since you code external functions with the same style and syntax as built-in functions, this makes it very easy to code and learn language extensions.