
- 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
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rexx - If else statement
The next decision-making statement is the if-else statement. An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.
Syntax
The general form of this statement in Rexx is as follows. −
if (condition) then do #statement1 #statement2 end else do #statement3 #statement4 end
In Rexx, the condition is an expression which evaluates to either true or false. If the condition is true, then the subsequent statements are executed. Else if the condition is evaluated to false, then the statements in the else condition are evaluated.
Flow Diagram
The flow diagram of the if-else statement is as follows −

From the above diagram, it can be noted that we have two code blocks. One gets executed if the condition is evaluated to true and the other if the code is evaluated to false.
The following program is an example of the simple if-else expression in Rexx.
Example
/* Main program */ i = 50 if (i < 10) then do say "i is less than 10" end else do say "i is greater than 10" end
The output of the above code will be −
i is greater than 10