begin #some routine rescue retry #on third retry,output "no dice!" end
我想这样做,以便在“第三次”重试时打印一条消息.
tries = 0 begin # some routine rescue tries += 1 retry if tries <= 3 puts "no dice!" end