I also tried some other examples from the net
and it worked only in this case
irb(main):014:0* callcc do |cc|
irb(main):015:1* for i in 0…10
irb(main):016:2> print "\n#{i}: "
irb(main):017:2> for j in 0…10
irb(main):018:3> cc.call if j == 5 and i == 5
irb(main):019:3> printf “%3i”, j
irb(main):020:3> end
irb(main):021:2> end
irb(main):022:1> end
irb(main):009:0> cc.call if cnt < 10
and cnt should become 10
The problem is IRB. It is a ruby program whose main loop reads your
input,
evaluates it, and shows you the result, so when you call the
continuation,
it only returns to the point where it shows you the result of your
input;
it doesn’t evaluate the statementes you entered later.
Try the example outside IRB.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.