Welcome to the world of Mainframe. 欢迎来到大型机的中文世界!

REXX中基本的运算符包括以下几种:

1. ‘+’:

2. ‘-‘:

3. ‘*’:

4. ‘/’:

5. ‘%’: 取整运算

6. ‘//’: 取余运算

例子:

say (5 % 2)  /* Returns the integer part of division result. Displays: 2  */
say (5 // 2)   /* Returns the remainder from division.      Displays: 1     */
say (5 ** 2)  /* Raises the number to the whole power.     Displays: 25    */
 REXX中的比较运算符主要包括:

1. ‘=’ : 相等
2. ‘\=’: 不等
3. ‘>’ : 大于
4. ‘<’ : 小于
5. ‘>=’ : 大于或者等于,即不小于
6. ‘<=’ : 小于或者等于,即不大于
7. ‘<>,><’ : 大于或者小于,即不等于
 例子:

'37'  = '37'    /*  TRUE   - a numeric comparison */
'0037'= '37'    /*  TRUE   - numeric comparisons disregard leading zeroes */
'37'  = '37   ' /*  TRUE   - blanks disregarded   */
'ABC' = 'Abc'   /*  FALSE  - string comparisons are case-sensitive        */
'ABC' = '   ABC  ' /*  TRUE- preceding & trailing blanks are irrelevant   */
''    = '     '    /*  TRUE- null string is blank-padded for comparison   */
 REXX中的关系运算符主要包括:

1. ‘&’ : 
2. ‘|’ : 
3. ‘\’ : 
例子:
if ('A' = var1) & ('B' = var2) then
     say 'Displays only if BOTH comparisons are TRUE'
if ('A' = var1) | ('B' = var2) then
     say 'Displays if EITHER comparison is TRUE'
if \('A' = var1) then say 'Displays if A is NOT equal to var1'

相关文章

  • Top Links

  • 功能

  • 文章归档