Skip to content

Instantly share code, notes, and snippets.

@imcodingideas
Created June 15, 2016 02:30
Show Gist options
  • Save imcodingideas/6b149d616b8241949a3d9988df9a0db7 to your computer and use it in GitHub Desktop.
Save imcodingideas/6b149d616b8241949a3d9988df9a0db7 to your computer and use it in GitHub Desktop.
Little chatbot learning some of the control flow in ruby.
chat_bot = "Ruby"
age = 32
city = "Hermosillo"
puts "Hello! My name is #{chat_bot}"
puts "What is your name?"
username = gets.chomp
puts "Hi there #{username}, great to meet you! How can I help you today?"
question = gets.chomp
if question == 'How old are you?'
puts "I am #{age} years old"
end
if question == 'Where do you live?'
puts "I live in #{city}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment