Vita Rara: A Life Uncommon

Here's the Ruby Version...

...of your first example:

myArray = []

i = 0

0.upto(2) do
  c = Proc.new do
    puts i
  end
  myArray << c
  i = i.next
end

myArray.each do |it|
  it.call
end

Reply

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
  • Allowed HTML tags: <a> <img> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <h1> <h2> <h3>
  • Lines and paragraphs break automatically.
More information about formatting options