Chapter 2. Language Basics

Overview

This chapter describes the basic elements of Rexx. It discusses the simple components that make up the language. These include script structure, elements of the language, operators, variables, and the like. As a starting point, we explore a simple sample script. We'll walk through this script and explain what each statement means. Then we'll describe the language components individually, each in its own section. We'll discuss Rexx variables, character strings, numbers, operators, and comparisons.

By the end of this chapter, you'll know about the basic components of the Rexx language. You'll be fully capable of writing simple scripts and will be ready to learn about the language features explored more fully in subsequent chapters. The chapters that follow present other aspects of the language, based on sample programs that show its additional features. For example, topics covered in subsequent chapters include directing the logical flow of a script, arrays and tables, input and output, string manipulation, subroutines and functions, and the like. But now, let's dive into our first sample script.

A First Program

Had enough of your job? Maybe it's time to join the lucky developers who create computer games for a living! The complete Rexx program that follows is called the Number Game. It generates a random number between 1 and 10 and asks the user to guess it (well, okay, the playability is a bit weak. . . .) The program reads the number the user guesses ...

Get Rexx Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.