Skip to content

Instantly share code, notes, and snippets.

@jarhart
Last active December 11, 2015 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarhart/4617501 to your computer and use it in GitHub Desktop.
Save jarhart/4617501 to your computer and use it in GitHub Desktop.
GOTO in Ruby
require 'continuation'
$goto_labels = {}
def label(name)
callcc { |k| $goto_labels[name] = k }
end
def goto(label_name)
$goto_labels[label_name].call
end
label :start
puts 'Hello World!'
goto :start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment