if x > 4 5 else 8 end
if x < 4 5 elsif x < 50 9 else 100 end
x = 42 puts "#{x} is the meaning of life, the universe, and everything" puts "but not #{x / 5.0}" puts 'but not #{x / 5.0}'
ruby puts 3 * 4 Control-D
ruby sum.rb 5 4 3 Control-ZControl-Z marks the end of input in Dos; use Control-D in Unix.
d:\> ruby sum.rb < fib100.txt
def max(a, b) if a > b a else b end end
count = 10 while count >= 1 puts count count -= 1 end
"-183".to_iand a float:
"15.18".to_f
if false then 'a' else 'b' end if nil then 'a' else 'b' end
if 0 then 'a' else 'z' end # or... !false !nil !0
largest = gets.to_i while (str = gets) n = str.to_i if n >= largest largest = n end end
def name(...parameters...) body end