continue(n)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ continue(n) ✨

the Tcl Built-In Commands girlies are back at it again and this one is literally the skip button for your loops πŸŽ€


NAME 🌸

continue β€” skip to the next iteration of a loop, no notes πŸ’…


SYNOPSIS πŸ¦‹

continue

DESCRIPTION πŸ’–

okay so bestie, picture this: you're deep inside the body of a looping command β€” like for or foreach or while β€” and you just need to bail on this one round and let the loop move on. that's literally what this is. 🫢

when you call it, continue returns a 4 (that's TCL_CONTINUE for the girlies keeping score at home), and that return value makes a continue exception happen. not me causing exceptions on purpose 😭 iconic behavior honestly.

so what does that exception do? it aborts the current script and unwinds it all the way out to the innermost containing loop command, and then that loop just… keeps going. next iteration. slay. πŸ”₯

and lowkey it's not only loops that handle these β€” continue exceptions also get handled in a few other situations too, like the catch command and the outermost scripts of procedure bodies. iykyk πŸ‘‘


EXAMPLE πŸ“

say you wanna print a line for each of the integers from 0 to 10 β€” but not 5, because 5 did something to you personally and you're holding a grudge:

for {set x 0} {$x<10} {incr x} {
    if {$x == 5} {
        continue
    }
    puts "x is $x"
}

see how the 5 gets skipped like it's on read? that's the whole vibe check right there. πŸ’€βœ¨


SEE ALSO 🌈


KEYWORDS πŸ‘‘

continue, iteration, loop β€” the holy trinity fr fr πŸŽ€


heads up bestie: this one is a control-flow girly, so it only makes sense inside a loop. calling it out in the wild is giving chaos energy πŸ™ˆ

and that's the tea, babe πŸ’œ this page came to you straight from Tcl (source: Tcl), and yes it's the continue(n) page β€” no date on this one, she's timeless, main character energy only πŸ‘‘πŸŒΈ


πŸ“¦ where this page comes from