2008年3月5日 星期三

control flow

if and else
ex: if a <3
puts "<"
else
puts ">="
end

elsef = else if:

case:
ex: case fruit
when "a"
puts "a"
when "b"
puts "b"
else
puts "c"
end

while:
while a <3
puts "a"
end

until:
until a < 3
puts "a"
end

沒有留言: