Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Two ways of doing the same thing followed by user input example */
- # Method 1
- case language
- when "JS"
- puts "Websites!"
- when "Python"
- puts "Science!"
- when "Ruby"
- puts "Web apps!"
- else
- puts "I don't know!"
- end
- # Method 2 (don't forget then)
- case language
- when "JS" then puts "Websites!"
- when "Python" then puts "Science!"
- when "Ruby" then puts "Web apps!"
- else puts "I don't know!"
- end
- # Example
- puts "Hello there! What language do you speak?"
- language = gets.chomp
- # Add your case statement below!
- case language
- when "English" then puts "Hello!"
- when "French" then puts "Bonjour!"
- when "German" then puts "Guten Tag!"
- when "Finnish" then puts "Haloo!"
- when "Spanish" then puts "Hola!"
- else puts "I don't know that language!"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement