Answers for "ruby asign variable from case statment"

0

ruby case assignment

#!/usr/bin/env ruby

trigger_value = 7

output_string = case trigger_value
  when 1
    "First number"
  when 7
    "Lucky number"
  else
    "Something else"
end

puts output_string   # Outputs: Lucky number
Posted by: Guest on September-22-2020

Browse Popular Code Answers by Language