Skip to content

Instantly share code, notes, and snippets.

@tkadauke
Created November 15, 2012 13:57
Show Gist options
  • Save tkadauke/4078751 to your computer and use it in GitHub Desktop.
Save tkadauke/4078751 to your computer and use it in GitHub Desktop.
Goto in Ruby :-)
LABELS = {}
def label(name)
LABELS[name] = callcc { |cc| cc }
end
def goto(name)
LABELS[name].call LABELS[name]
end
x = 0
label :start
x += 1
puts x
goto :start if x < 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment