0
0

More than 3 years have passed since last update.

Rubyの演算優先順位

Last updated at Posted at 2020-11-24

Rubyでの演算処理は、以下の優先順位に従って実行される。

優先順位:高

::
[]
+(単項), !,  ~
**
-(単項)
*,  /,  %
+,  -
<<,  >>
&
|,  ^
\>,  >=,  <,  <=
<=>,  ==,  ===,  !=,  =~,  !~
&&
||
..,  ...
?:(条件演算子)
= (+=,  -=,  ...等も含む)
not
and,  or

優先順位:低
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0