Ruby Operators : Operators « Language Basics « Ruby






Ruby Operators


Operator    Description 
[ ]         Array reference
[ ]=        Array element set
**          Exponentiation
!           Not
~           Complement
+           Unary plus
-           Minus
*           Multiply
/           Divide
%           Modulo
+           Plus
-           Minus
>>          Right shift
<<          Left shift
&           Bitwise And
^           Bitwise exclusive Or (Xor)
|           Regular Or
            Comparison operators:
<=          Less than or equal to
<           Less than
>           Greater than
>=          Greater than or equal to
            Equality and pattern match operators:
<=>         Less than, equal to, greater than
==          Equal to
===         Tests equality in a when clause of a case statement
!=          Not equal to
=~          Regular expression pattern match
&&          Logical And
||          Logical Or
..          Inclusive range
...         Exclusive range
?           Ternary if
:           Else
            Assignment
=           Normal assign
%=          Modulus and assign
/=          Divide and assign
-=          Subtract and assign
+=          Add and assign
*=          Multiply and assign
**=         Exponent and assign
defined?    True if symbol defined
not         Logical negation
and         Logical composition
or   

 








Related examples in the same category

1.chain statements together.