
- Rexx Tutorial
- Rexx - Home
- Rexx - Overview
- Rexx - Environment
- Rexx - Installation
- Rexx - Installation of Plugin-Ins
- Rexx - Basic Syntax
- Rexx - Datatypes
- Rexx - Variables
- Rexx - Operators
- Rexx - Arrays
- Rexx - Loops
- Rexx - Decision Making
- Rexx - Numbers
- Rexx - Strings
- Rexx - Functions
- Rexx - Stacks
- Rexx - File I/O
- Rexx - Functions For Files
- Rexx - Subroutines
- Rexx - Built-In Functions
- Rexx - System Commands
- Rexx - XML
- Rexx - Regina
- Rexx - Parsing
- Rexx - Signals
- Rexx - Debugging
- Rexx - Error Handling
- Rexx - Object Oriented
- Rexx - Portability
- Rexx - Extended Functions
- Rexx - Instructions
- Rexx - Implementations
- Rexx - Netrexx
- Rexx - Brexx
- Rexx - Databases
- Handheld & Embedded
- Rexx - Performance
- Rexx - Best Programming Practices
- Rexx - Graphical User Interface
- Rexx - Reginald
- Rexx - Web Programming
- Rexx Useful Resources
- Rexx - Quick Guide
- Rexx - Useful Resources
- Rexx - Discussion
Rexx - If statement
The first decision-making statement is the if statement. An if statement consists of a Boolean expression followed by one or more statements.
Syntax
The general form of this statement in Rexx is as follows −
if (condition) then do #statement1 #statement2 end
In Rexx, the condition is an expression which evaluates to either true or false. If the condition is true, then the subsequent statements in the loop are executed.
Flow Diagram
The following diagram shows the diagrammatic explanation of this loop.

In the above diagram, you can see that only if the condition is evaluated to true does the conditional code gets executed.
The following program is an example of the simple if expression in Rexx.
Example
/* Main program */ i = 5 if (i < 10) then do say "i is less than 10" end
The following key things need to be noted about the above program −
The if statement is used to first evaluate if the value of i is less than 10.
If yes, then the statement inside the do loop is evaluated.
The output of the above program will be −
i is less than 10