ruby case assignment code example
Example: 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