Skip to content

Instantly share code, notes, and snippets.

@kcelestine
Created June 10, 2014 02:41
Show Gist options
  • Save kcelestine/15dbab7b4dc30969964c to your computer and use it in GitHub Desktop.
Save kcelestine/15dbab7b4dc30969964c to your computer and use it in GitHub Desktop.
puts "Welcome to Khadijah's homework"
loop do
puts "Enter (1)\tList all trains"
puts "Enter (2)\tView Stations for single train line"
puts "Enter (Q)\tQuit and exit"
print "Please choose an option: "
choice = gets.chomp
if choice == "1"
puts "The (L) Train, The (N) Train, The (S)ix Train"
elsif choice == "2"
puts "The (L) Train, The (N) Train, The (S)ix Train"
print "Please choose a train: "
choice = gets.chomp
if choice == "L"
puts "The (L) Train"
puts "8th Ave | 6th Ave | Union Square | 3rd Ave | 1st Ave | Bedford Ave"
elsif choice == "N"
puts "The (N) Train"
puts "Times Square | Herald Square | 28th St | 23rd St - HAMco Terminal | Union Square | 8th St"
elsif choice == "S"
puts "The (S)ix Train"
puts "Grand Central | 33rd St | 28th St | 23rd St | Union Square | Astor Place"
end
elsif choice == "Q" || choice == "quit"
puts "Thank you and Goodbye!\n"
exit
end
end
@DrRobotmck
Copy link

Great job on this assignment. A few notes:

  • Make sure you keep an eye on your indentation and that your text editor is set to the style specifications for the language you are writing in. For ruby and javascript it will always be 2 spaces or 1 tab. Indentation really helps with readability and segmenting/organizing sections of your code.
  • Great use of an OR statement for checking your quitting condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment