In Ruby is it possible to create a local variable explicitly -
e.g.
x = 123 p = proc.new { x = 'i not want change value of outer x, want create local x' }
in ruby there same "my" keyword in perl ?
as per perl documentation of my,i think looking below in ruby:-
x = 123 p = proc.new {|;x| x = 'i not want change value of outer x, want create local x' } p.call # => "i not want change value of outer x, want create local x" x # => 123
Comments
Post a Comment