Sha256: c80eccb990c6ccaadde9c548fdf7bd42f7e8e9faf1278c96edb555f97e35df26

Contents?: true

Size: 639 Bytes

Versions: 37

Compression:

Stored size: 639 Bytes

Contents

1つの数値を受け取り、それが10より大きければ「greater」小さければ「smaller」と表示するプログラムを作成せよ、


- if ~ else ~ end

if 条件
  条件が成り立ったときに実行したい処理
else
  条件が成り立たなかったときに実行したい処理
end


条件によってプログラムの挙動を変える際に用いるメソッド。
条件には値がtrue かfalse となる式を書くのが一般的。
例えば、2つの値を比較して一致すればtrue,しなければfalseといった具合。
また、不等号は「<=」、等号は「==」を用いる。

Version data entries

37 entries across 24 versions & 1 rubygems

Version Path
ruby_learner-1.2.9 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.8 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.7 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.6 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.5 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.4 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.3 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.2 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.1 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.2.0 contents/takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.15 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.14 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.14 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.13 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.13 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.11 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.11 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.10 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.10 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.9 questions/sequential_check/section_4/part_1/lib/sentence.org