Ruby for Instance / Switch

# Define a variable
x = "hello"

# Use the case statement to compare x against several cases
case x
when "hello"
  puts "x is hello"
when "world"
  puts "x is world"
else
  puts "x is something else"
end

Try on playground

Next: arrays

made with by dfxe / source / license