
- 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 - Arithmetic Operators
The Rexx language supports the normal Arithmetic Operators as any the language. Following are the Arithmetic Operators available in Rexx.
Operator | Description | Example |
---|---|---|
+ | Addition of two operands | 1 + 2 will give 3 |
− | Subtracts second operand from the first | 1 - 2 will give -1 |
∗ | Multiplication of both operands | 2 ∗ 2 will give 4 |
/ | Division of numerator by denominator | 2 / 2 will give 1 |
// | Remainder of dividing the first number by the second | 3 // 2 will give 1 |
% | The div component will perform the division and return the integer component. | 3 % 2 will give 1 |
Example
The following program shows how the various operators can be used.
/* Main program*/ X = 40 Y = 50 Res1 = X + Y Res2 = X - Y Res3 = X * Y Res4 = X / Y Res5 = X % Y Res6 = X // Y say Res1 say Res2 say Res3 say Res4 say Res5 say Res6
The output of the above program will be −
90 -10 2000 0.8 0 40
rexx_operators.htm
Advertisements