Advertisement
Hiteshw11

Hashes in Ruby

Sep 25th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.19 KB | None | 0 0
  1. states = {
  2. "Pennsylvania" =>"PA",
  3. "Texas" =>"TX",
  4. "Alaska" =>"AK",
  5. "Hawaii" =>"HI"
  6. }
  7.  
  8. puts "Enter the state for which you need the code"
  9. a=gets.chomp()
  10. puts "the code is"
  11. print states[a]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement