跳转到内容

Rexx 编程/Rexx 指南/数值比较

来自维基教科书,开放的书籍,为开放的世界

以下示例展示了使用比较运算符进行数值比较

x = 3 如果 x > 2 那么

 say "x is greater than 2"

支持的操作符

[编辑 | 编辑源代码]

支持以下比较运算符

= 	Equal To
\= 	Not Equal To
< 	Less Than
> 	Greater Than
<= 	Less Than or Equal To
>= 	Greater Than or Equal To
\< 	Not Less Than
\> 	Not Greater Than
<> 	Not Equal To
>< 	Not Equal To

数值比较时会忽略前导零

[编辑 | 编辑源代码]

为了进行数值比较,会忽略前导零

x = "002"
if x = 2 then
  say "x equals 2"

数值比较时会忽略前导和尾随空格

[编辑 | 编辑源代码]
y = " 10 "
if y = 10 then
  say "y equals 10"
华夏公益教科书