i = 0 numbers = [] while i < 6 puts "At the top i is #{i}" numbers.push(i) i += 1 puts "Numbers now: ", numbers puts "At the bottom i is #{i}" end puts "The numbers: " # remember you can write this 2 other ways? numbers.each {|num| puts num }
def zero_to_n(n) @numbers = [] for i in (0...n) puts "At the top i is #{i}" @numbers.push(i) puts "Numbers now: ", @numbers puts "At the bottom i is #{i}" end end puts "Please input a number:" n = $stdin.gets.chomp.to_i zero_to_n(n) puts "The numbers: " # remember you can write this 2 other ways? @numbers.each {|num| puts num }