case
语句的 if
语句。
使用最小分支数字段为得到的
case
语句指定最小 when
分支数。
示例:
fruit = gets
if fruit == 'apple' # Simplifiable 'if' statement
puts 'This is apple!'
elsif fruit == 'peach'
puts 'This is peach!'
elsif fruit == 'orange'
puts 'This is orange!'
elsif fruit == 'banana'
puts 'This is banana!'
end