Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Code
- #which_category = gets.chomp
- #which_category.to_i
- which_category = 0
- case which_category
- when 0
- puts "We are in case 0"
- when 1
- when 2
- else
- puts "Skipping File. Give it a category by running this script again."
- end
- ## Question
- When I hard code 0, the code runs as expected and outputs "We are in case 0" but when I do gets.chomp, it hits the else case.
- I've tested puts which_category.inspect whose result is "0". I've tried which_category.to_i and it still went to the else case.
- What obvious thing is this newbie missing?
Add Comment
Please, Sign In to add comment