Advertisement
Narzew

Ruby continuation

Mar 24th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.25 KB | None | 0 0
  1. # Skrypt na goto w Ruby (moze nie dzialac na nowszych implementacjach)
  2.  
  3. require 'continuation' # Required in some implementations
  4. $tickets = {}
  5. def ticket(symbol)
  6. callcc {|c| $tickets[symbol] = c }
  7. end
  8. def goto(symbol)
  9. $tickets[symbol].call
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement