Skip to content

Instantly share code, notes, and snippets.

@rthbound
Created July 1, 2015 15:11
Show Gist options
  • Save rthbound/7c7692a920137d2ff2f4 to your computer and use it in GitHub Desktop.
Save rthbound/7c7692a920137d2ff2f4 to your computer and use it in GitHub Desktop.
5/6 chance of never exiting
2.2.0 :001 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):1:in `call'
from (irb):1:in `new'
from (irb):1:in `block in irb_binding'
from (irb):1:in `loop'
from (irb):1
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :002 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):2:in `call'
from (irb):2:in `new'
from (irb):2:in `block in irb_binding'
from (irb):2:in `loop'
from (irb):2
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :003 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):3:in `call'
from (irb):3:in `block (2 levels) in irb_binding'
from (irb):3:in `call'
from (irb):3:in `block in irb_binding'
from (irb):3:in `loop'
from (irb):3
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :004 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):4:in `call'
from (irb):4:in `new'
from (irb):4:in `block in irb_binding'
from (irb):4:in `loop'
from (irb):4
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :005 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):5:in `call'
from (irb):5:in `block (2 levels) in irb_binding'
from (irb):5:in `call'
from (irb):5:in `block in irb_binding'
from (irb):5:in `loop'
from (irb):5
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :006 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):6:in `call'
from (irb):6:in `rand'
from (irb):6:in `block in irb_binding'
from (irb):6:in `loop'
from (irb):6
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :007 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
^CIRB::Abort: abort then interrupt!
from (irb):7:in `call'
from (irb):7:in `new'
from (irb):7:in `block in irb_binding'
from (irb):7:in `loop'
from (irb):7
from /home/rth/.rvm/rubies/ruby-2.2.0/bin/irb:11:in `<main>'
2.2.0 :008 > @proc = Proc.new { break }; loop { rand(6) == 0 ? x = "lucky" : @proc = Proc.new { x = "unlucky" }; @proc.call }
=> nil
@proc = Proc.new { break }; loop { rand(6) == 0 ? "lucky" : @proc = Proc.new { puts "unlucky" }; @proc.call }
@rthbound
Copy link
Author

rthbound commented Jul 2, 2015

Failed to exit 7/8 times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment