From: Massimo M. <mas...@ri...> - 2025-04-01 05:52:57
|
I apologize for (ab)using this mailing list to ask a question that maybe has a trivial answer. I just can't have the 'on break' clause be triggered in a loop controlled by a 'try' construct try { while {[some_expensive_query]} { # .... if {[some_intervening_condition]} { return -code break -level 0 } # .... } } on break {} { puts " ---- break ----" puts "Loop interrupted by break" } on ok {} { puts "Loop completed normally" } finally { puts "done" } and you have a normal termination even though the loop was interrupted prematurely by [some_intervening_condition] I can get what I want by raising an exception with 'throw' and then using the trap clause which allows extra control over the cause of the exception (-errorcode receives no special treatment unless the option -code error is passed) but what is the purpose of the 'on break' clause if it's not handling a break? -- Massimo |