[[Ruby]]

*if [#q4cb3960]
  x >= y y以上
  x <= y y以下 

***パターン1 [#h3b9be82]
 a = 10
 if a > 10 then
   puts "BIG"
 else
   puts "Not big"
 end

***パターン2(省略系) [#mf8293f7]
 a = 10
 puts "BIG"  if a > 9

***パターン3 (省略系)[#ffe51460]
 a = 10
 puts a > 9 ? "big" : "small"

*case [#oe501c63]
 signal = "pink"
 
 case signal
 when "red"
  puts "STOP"
 when "yellow"
  puts "STOP"
 when "green", "blue"
  puts "GO"
 else
  puts "no signal"
 end

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS