Skip to content

Instantly share code, notes, and snippets.

@dudgeon
dudgeon / AskerValidater
Created March 25, 2012 14:04
Asks questions defined in a array:questions, validates answers based on array:questions_type, stores answers in array:answers
# Question Asker
def ask question
puts question
answer = gets.chomp
answer
end
# Yes/No Question Asker
def ask_yn question
puts question
@dudgeon
dudgeon / YN Asker
Created March 25, 2012 14:00
Asks yes/no question, validates response
# Asks yes/no questions; validates the answer
def ask_yn question
puts question
answer = gets.chomp.downcase
while answer != ('yes' || 'no')
puts 'Please answer \'yes\' or \'no\'.'
answer = gets.chomp.downcase
end
@dudgeon
dudgeon / Def Question
Created March 25, 2012 12:47
Def Question #My first Gist
def ask question
puts question
answer = gets.chomp
answer
end
answer_1 = ask question_1