lib/stack_overflow/cli.rb
# Allows user to view questions, switch lists or exit
Allows user to view questions, switch lists or exit
Allows user to view questions switch lists or exit
def menu
    input = nil
    puts "Enter the number of the question you want to see, type 'list' to choose a new list of quesitons or type 'exit': "
    puts @@divider
    input = gets.strip.downcase
    if input.to_i > 0 && input.to_i < @questions.length + 1
      question = @questions[input.to_i - 1]
      display_question(question)
    elsif input == "list"
      list_questions
    elsif input == "exit"
      goodbye
    else
      puts "Please make a valid selection."
      menu
    end
  end
def menu input = nil puts "Enter the number of the question you want to see, type 'list' to choose a new list of quesitons or type 'exit': " puts @@divider input = gets . strip . downcase if input . to_i > 0 && input . to_i < @questions . length + 1 question = @questions [ input . to_i - 1 ] display_question ( question ) elsif input == "list" list_questions elsif input == "exit" goodbye else puts "Please make a valid selection." menu end end
Allows user to view questions, switch lists or exit
Allows user to view questions switch lists or exit