Skip to content

Instantly share code, notes, and snippets.

@dacc
Created May 18, 2010 02:24
Show Gist options
  • Save dacc/404524 to your computer and use it in GitHub Desktop.
Save dacc/404524 to your computer and use it in GitHub Desktop.
ruby-1.9.1-p378 > i = 2
=> 2
ruby-1.9.1-p378 > p = Proc.new {
ruby-1.9.1-p378 > if j == nil
ruby-1.9.1-p378 ?> j = i
ruby-1.9.1-p378 ?> end
ruby-1.9.1-p378 ?> j
ruby-1.9.1-p378 ?> }
=> #<Proc:0x000001008d7318@(irb):52>
ruby-1.9.1-p378 > p.call
=> 2
ruby-1.9.1-p378 > i = 3
=> 3
ruby-1.9.1-p378 > p.call
=> 3
ruby-1.9.1-p378 >
ruby-1.9.1-p378 > i.clone
TypeError: can't clone Fixnum
from (irb):61:in `clone'
from (irb):61
from /Users/dan/.rvm/rubies/ruby-1.9.1-p378/bin/irb:17:in `<main>'
ruby-1.9.1-p378 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment