Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. puts "Press a key"
  2. key = STDIN.getc
  3. puts key.class
  4. puts "You have pressed #{key}"
  5. puts key.class
  6. while key != "f" do
  7. case key
  8. when "g"
  9. puts "It's 'g'"
  10. when "h"
  11. puts "It's 'h'"
  12. when "j"
  13. puts "It's 'j'"
  14. else
  15. puts "You gave me #{key} -- I have no idea what to do with that."
  16. end
  17. puts "Press a key"
  18. key = STDIN.getc
  19. puts "You have pressed #{key}"
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement