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.1.9 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.8 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.8 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.7 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.7 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.6 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.6 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.5 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.5 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.4 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.4 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.3 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.3 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.2 questions/sequential_check/section_4/part_1/lib/sentence.org
ruby_learner-1.1.2 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.1 takahashi/sample_prog/question/4_1.org
ruby_learner-1.1.1 questions/sequential_check/section_4/part_1/lib/sentence.org