Rexx-operators
提供:Dev Guides
Rexx-オペレーター
演算子は、特定の数学的または論理的な操作を実行するようコンパイラーに指示する記号です。
Rexxには、次のように詳細に説明されているさまざまなタイプの演算子があります-
- 算術演算子
- 関係演算子
- 論理演算子 *ビットごとの演算子
算術演算子
Rexx言語は、すべての言語として通常の算術演算子をサポートしています。 以下は、Rexxで使用可能な算術演算子です。
リンク:/rexx/rexx_arithmetic_operators [例を表示]
Operator | Description | Example |
---|---|---|
PLUS | Addition of two operands | 1 PLUS 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 |
関係演算子
関係演算子を使用すると、オブジェクトを比較できます。 以下は、Rexxで使用可能な関係演算子です。 Rexxでは、真の値は1で示され、偽の値は0で示されます。
link:/rexx/rexx_relational_operators [例を表示]
Operator | Description | Example |
---|---|---|
== | Tests the equality between two objects | 2 = 2 will give 1 |
< | Checks to see if the left object is less than the right operand. | 2 < 3 will give 1 |
=< | Checks to see if the left object is less than or equal to the right operand. | 2 =< 3 will give 1 |
> | Checks to see if the left object is greater than the right operand. | 3 > 2 will give 1 |
>= | Checks to see if the left object is greater than or equal to the right operand. | 3 > 2 will give 1 |
論理演算子
論理演算子は、ブール式を評価するために使用されます。 以下は、Rexxで使用可能な論理演算子です。
リンク:/rexx/rexx_logical_operators [例を表示]
Operator | Description | Example |
---|---|---|
& | This is the logical “and” operator | 1 or 1 will give 1 |
This is the logical “or” operator | ||
1 or 0 will give 1 | \ | This is the logical “not” operator |
\0 will give 1 | && | This is the logical exclusive “or” operator |
ビット演算子
Groovyは4つのビット演算子を提供します。 以下は、Groovyで使用可能なビットごとの演算子です。
リンク:/rexx/rexx_bitwise_operators [例を表示]
Sr.No. | Operator & Description |
---|---|
1 |
これはビット単位の「and」演算子です |
2 |
bitor これはビット単位の「or」演算子です |
3 |
bitxor これはビット単位の「xor」または排他的論理和演算子です |
演算子の優先順位
次の表に、Rexx演算子の演算子の優先順位を、優先順位の降順で示します。
Operators | Precedence |
---|---|
Prefix operators | PLUS - \ |
Addition and subtraction | PLUS - |
Comparison operators | = == > < >= ⇐ |
Logical AND | & |
Logical OR | |
EXCLUSIVE OR |