0
0

More than 5 years have passed since last update.

演算子の優先順位と意味

Posted at

はじめに

用語と定義をしっかり覚える事が好きな自分用です。
演算子の優先順位とその意味を見やすくまとめようと思い投稿します。

優先順位

[高]   +(単項)  !  ~          !  否定演算子, ~a ビット演算子、aが1ならば0、またその逆
       **               ** 代数演算子, a**b aのb乗
       -(単項)                 
       *  /  %                   %  代数演算子, a%b aをbで割った時の余り
       +  -
       > >=  < <=
       <=> ==  === !=  =~  !~    <=> 宇宙船演算子, =~ 正規表現演算子 
       &&                        && 論理演算子, a && b aかつbが真ならば真
       ||                        || 論理演算子, a || b aまたはbが真ならば真
       ..  ...            .. 範囲演算子
       ?:(条件演算子)         ?= 条件演算子, a ? b : c aが真ならばbその他はc
       =
       not
[低]   and or

0
0
0

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