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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -