Skip to content

Instantly share code, notes, and snippets.

@jdecuirm
Created December 17, 2014 02:48
Show Gist options
  • Save jdecuirm/99859fea2b2fb5b94b95 to your computer and use it in GitHub Desktop.
Save jdecuirm/99859fea2b2fb5b94b95 to your computer and use it in GitHub Desktop.
ARGV and gets.chomp
name, last_name = ARGV
print "Now we have your name and last name, can you help us providing your age? "
age = gets.chomp
print "Thanks, now will be helpful to have your favorite food: "
favorite_food = gets.chomp
puts "Hi #{name} #{last_name}, we now you are #{age} years old, and you love to eat #{favorite_food}"
@jdecuirm
Copy link
Author

This is the error i get:

Now we have your name and last name, can you help us providing your age? ex13_3.rb:4:in gets': No such file or directory @ rb_sysopen - Oliver (Errno::ENOENT) from ex13_3.rb:4:ingets'
from ex13_3.rb:4:in `

'

Copy link

ghost commented Jul 27, 2015

Change gets.chomp to $stdin.gets.chomp on lines 4 and 6

Copy link

ghost commented Jul 27, 2015

Change gets.chomp to $stdin.gets.chomp on lines 4 and 6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment