1
2

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 学習 基本 (if , if else , elsif文の書き方)

Posted at

# はじめに
Rubyの学習を始めました。学んだことを忘れないように備忘録として残しています。

if文の書き方


  if 条件式

      処理 # 条件式が成り立てば実行される。

   end

if else文の書き方


   if 条件式
      処理 # 条件式がTrueの時に実行
   else     
      処理 # 条件式がFalseの時に実行
   end

elsif文の書き方


   if 条件式1
      処理   #条件式1がTrueの時に 
   elsif 条件式2
      処理   #条件式1がFalseで条件式2がTrueの時に実行
   else
      処理   #条件式1&2ともFalseの時に実行
   end
1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?