A
Angel Martin
In first place I sorprised with te behavior of formal variables inside a
metod or proc:
I google this and in the faq warn about it, calling it formal variables.
Ok, if I want to change the value of a Array i can use Array#replace,
but is a way to change other types, Fixnum for example.
Is any way to do this??
Thanks in advance,
Angel
metod or proc:
irb(main):020:0> a=proc { |i| p i.id;i=7;p i.id}
=> #<Proc:0x4028b604@(irb):20>
irb(main):021:0> b=5
=> 5
irb(main):022:0> b.id
=> 11
irb(main):023:0> a.call(b)
11
15
=> nil
irb(main):024:0> b.id
=> 11
I google this and in the faq warn about it, calling it formal variables.
Ok, if I want to change the value of a Array i can use Array#replace,
but is a way to change other types, Fixnum for example.
Is any way to do this??
Thanks in advance,
Angel