Skip to content

Instantly share code, notes, and snippets.

@padde

padde/goto.rb

Created Jun 4, 2014
Embed
What would you like to do?
require 'continuation'
$__labels__ = {}
def label(label)
callcc {|cc| $__labels__[label] = cc }
end
def goto(label)
$__labels__[label].call
end
def a
label :c
puts 'i call b'
b
end
def b
puts 'i goto c'
goto :c
end
a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment