1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

演算子について (Ruby)

Last updated at Posted at 2019-05-16

#演算子
計算処理をする際に使用する数式記号

+

使用用途:足し算
(例)  1000  +  1000  =>  2000

-

使用用途:引き算
(例)  2000  -  1000  =>  1000

*

使用用途:掛け算
(例)  5  *  8  =>  40

/

使用用途:割り算
(例)  100  /  2  =>  50

%

使用用途:剰余(余りを求める)
(例)  5  %  2  =>  1

**

使用用途:べき乗
(例)  5  **  2  =>  25
#比較演算子(<,>,==)
値を比較する際に使用する
式が真であればtrue,偽であればfalseを返す

(例)
1  **<**  7  =>  true

1  >  7  =>  false

7  -  1  >=  8  =>  false

6  /  2  ==  12  /  4  =>  true
#not演算子(!)
否定の意味で使う
式が偽であればtrue,真であればfalseを返す

(例)
3  +  5  !=  20  =>  true

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?