-
Notifications
You must be signed in to change notification settings - Fork 1
Operators
datanorris edited this page Jan 22, 2016
·
25 revisions
- (unary minus)
- (unary +) ~
! not
& (binary & or formal block arg)
- (binary minus) %
- (binary *) ** / (binary /) ^ |
- (binary +) << (left shift)
=~ !~
<
= <= <=> == != ===
=
&&= ||=
|= %= &= **= *= ^= -= += /= <<=
=
&& || ? (ternary ?:) and or
defined?
Also for flipflops
.. ...
| No | Type | Description | Operators | Associativity |
|---|---|---|---|---|
| 1 | Unary | General |
! ~ +
|
Right |
| 2 | Binary | Power | ** |
Right |
| 3 | Unary | Minus | - |
Right |
| 4 | Binary | Products |
* / %
|
Left |
| 5 | Binary | Additions |
+ -
|
Left |
| 6 | Binary | Shifts |
<< >>
|
Left |
| 7 | Binary | Bitwise and | & |
Left |
| 8 | Binary | Bitwise or | ` |
^` |
| 9 | Binary | Directional comparisons |
> >= < <=
|
Left (why?) |
| 10 | Binary | General comparisons |
<=> == === != =~ !~
|
None |
| 11 | Binary | Logical and, argument form | && |
Left |
| 12 | Binary | Logical or, argument form | ` | |
| 13 | Binary | Range constructors |
.. ...
|
Left |
%right '?' ':' %left modifier_rescue %right '=' tOP_ASGN %nonassoc keyword_defined %right keyword_not %left keyword_or keyword_and %nonassoc modifier_if modifier_unless modifier_while modifier_until
A Ruby Language Reference
Copyright © by Michael Hore, 2016.
Introduction to This Document
Ruby Elements
- Classes and Modules
- Methods
- Blocks, Procs and Lambdas
- Execution Context and Closures
- Variables, Constants and Namespaces
- Types and Literals
- Ruby Expressions
- Operators
Syntax Grammar
Exceptions and Throw
Ruby Sourcefiles and Libraries
Multi Threading
Execution and Lifecycle