Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_questions
- puts "What is the file name where the questions are located, including extension ?"
- questions_file = gets.chomp
- file = File.new( questions_file , 'r')
- unless file.exists? do
- puts "That is not a valid file!"
- break
- return
- end
- end
- def question(str, hash)
- answers = 1
- puts str
- hash.each do | rightwrong, string |
- if rightwrong = 'true'
- answers = string
- else
- continue
- end
- end
- return answers
- end
- def get_answer
- puts "Please enter your choice: "
- choice = gets.chomp
- if choice == nil or !choice.respond_to?('to_i')
- puts "You have entered an incorrect choice, please try again."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement