J
Jens Finnäs
Hi, I've just started learning Ruby for screen scraping purposes and
I've now run in to a problem I can't get my head around.
Is it not possible to call an array outside a defintion? Like this:
list = Array.new
list = ["a", "b", "c"]
def do_stuff()
list.each_index do |i|
puts list
end
end
do_stuff()
If I define list inside do_stuff() the script works. My plan was to
build an array through several functions.
I've now run in to a problem I can't get my head around.
Is it not possible to call an array outside a defintion? Like this:
list = Array.new
list = ["a", "b", "c"]
def do_stuff()
list.each_index do |i|
puts list
end
end
do_stuff()
If I define list inside do_stuff() the script works. My plan was to
build an array through several functions.