High to low precedence of Ruby operators
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
::
[]
**
-(unary) +(unary) ! ~
* / %
+ -
<< >>
&
| ^
> >= < <=
<=> == === != =~ !~
&&
||
.. ...
= += -=...
not
and or
|
Source:
http://migo.sixbit.org/papers/Introduction_to_Ruby/slide-21.html
http://www.meshplex.org/wiki/Ruby/Variables_Datatypes_Operators4
Rule Of Thumb:
Use logical operator for logical statements use logical composition sparingly.
[ Last updated: August 10, 2007 @ 07:48 PM ]




Sorry, comments are closed for this article.