Skip to content

Instantly share code, notes, and snippets.

@grauwoelfchen
Last active December 22, 2015 14:38
Show Gist options
  • Save grauwoelfchen/6486920 to your computer and use it in GitHub Desktop.
Save grauwoelfchen/6486920 to your computer and use it in GitHub Desktop.
cat = "Tama"
rabbit = "Peter"
%w[Pochi Taro Hachi].map do |dog; cat, rabbit, wolf|
p cat #=> nil
p rabbit #=> nil
p wolf #=> nil
cat = dog
rabbit = "Bob"
end
p cat #=> "Tama"
p rabbit #=> "Peter"
p wolf #=> NameError: undefined local variable or method `wolf' for XXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment