In Ruby is it possible to create a local variable explicitly
block, local, proc, ruby, variables
Solution
As per the Perl documentation of my,I think you are looking for something like below in Ruby:-
x = 123
p = Proc.new {|;x|
x = 'I do not want change the value of the outer x, I want to create a local x'
}
p.call
# => "I do not want change the value of the outer x, I want to create a local x"
x # => 123
Problem
e.g. ``` x = 123 p = Proc.new { x = 'I do not want change the value of the outer x, I want to create a local x' } ``` In Ruby Is there something the same as "my" keyword in Perl ?