Advertisement
t_a_w

Wanna ride?

Jul 6th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.59 KB | None | 0 0
  1. we_wanna_ride = true
  2. stops = ["East Bumpspark", "Endertromb Avenue", "New Mixico", "Mal Abochny"]
  3. while we_wanna_ride
  4.   print "Where ya headin', friend?: "
  5.   destination = gets.chomp
  6.   puts destination.gsub(/\w+/, &:capitalize)
  7.   if stops.include? destination  
  8.     puts "I know how to get to #{destination.capitalize!}! Here's the station list:"
  9.     stops.each do |stop|
  10.       puts stop
  11.       break if stop == destination
  12.       we_wanna_ride = false
  13.     end
  14.   else
  15.     puts "Sorry, we don't stop at that station. Maybe another time!"
  16.     we_wanna_ride = false
  17.   end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement