Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'continuation'
- counter = 0
- inner_counter = 0
- go_to_counter = callcc { |x| x }
- counter += 1
- puts "I've restarted #{counter} times"
- go_to_inner_counter = callcc { |x| x }
- inner_counter += 1
- puts "I've gone to inner counter #{inner_counter} times"
- if (inner_counter % 2).zero?
- go_to_inner_counter.call(go_to_inner_counter)
- end
- go_to_counter.call(go_to_counter) if counter < 10
- puts "OK I'm done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement