fork download
  1. number = 1
  2.  
  3. comment = case number % 3
  4. when 0 then "3の倍数です。"
  5. when 1 then "3で割ると1余ります。"
  6. when 2 then "3で割ると2余ります。"
  7. end
  8.  
  9. puts "#{number}は#{comment}"
Success #stdin #stdout 0.01s 6288KB
stdin
Standard input is empty
stdout
1は3で割ると1余ります。