Skip to content

Instantly share code, notes, and snippets.

@banister
Last active December 16, 2015 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save banister/5398088 to your computer and use it in GitHub Desktop.
Save banister/5398088 to your computer and use it in GitHub Desktop.
print "Enter a count: "
count = gets.chomp.to_i
values = []
count.times do
print "Enter a value: "
values << gets.chomp.to_i
end
values.each do |value|
puts value
end
#Expected Output:
#Enter a count: 3
#Enter a value: 1
#1
#Enter a value: 2
#2
#Enter a value: 3
#3
#1
#2
#3
#
#Actual Output:
#
#Enter a count: 3
#Enter a value: 1
#1
#Enter a value: 2
#2
#Enter a value: 3
#3
#0
#0
#0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment