ex 14 extra credit
This commit is contained in:
parent
c9d0be6147
commit
675664b042
28
ex14-ec.rb
Normal file
28
ex14-ec.rb
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
user = ARGV.first
|
||||||
|
prompt = '~: '
|
||||||
|
|
||||||
|
puts "Hi #{user}, I'm the #{$0} script."
|
||||||
|
puts "I'd like to ask you a few questions."
|
||||||
|
puts "Do you like me #{user}?"
|
||||||
|
print prompt
|
||||||
|
likes = STDIN.gets.chomp
|
||||||
|
|
||||||
|
puts "Where do you live #{user}?"
|
||||||
|
print prompt
|
||||||
|
lives = STDIN.gets.chomp
|
||||||
|
|
||||||
|
puts "What kind of computer do you have?"
|
||||||
|
print prompt
|
||||||
|
computer = STDIN.gets.chomp
|
||||||
|
|
||||||
|
puts "What's your favorite name for a dog?"
|
||||||
|
print prompt
|
||||||
|
dogname = STDIN.gets.chomp
|
||||||
|
|
||||||
|
puts <<MESSAGE
|
||||||
|
Alright, so you said #{likes} about liking me.
|
||||||
|
You live in #{lives}. Not sure where that is.
|
||||||
|
And you have a #{computer} computer. Nice.
|
||||||
|
You also said that your favorite name for a
|
||||||
|
dog is #{dogname}. Works for me.
|
||||||
|
MESSAGE
|
Loading…
Reference in New Issue
Block a user