Meeting some Locals

1 · Jan Lelis · May 14, 2015, midnight
There are two very different ways to create local variables in Ruby. You are probably familiar with the classical way: a, b = "$", "€" a # => "$" b # => "€" It is simple to understand and looks good. But Ruby would not be Ruby, if there weren't for more obscure ways to assign variables: You could rewrite the previous example to create local variables in a more subtle way: %r<(?'a'.)(?'b'.)>=~"$" "€" a # => "$" b # => "€" Implicit Local Variables Through Regex Matching Without the fancy obfusc...