BREAK(1)

πŸ’… NAME πŸ’…

break β€” it stops the current inner loop, bestie. That's the whole assignment, and it ate. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

LOOP_CONSTRUCT
   [COMMANDS ...]
   break
   [COMMANDS ...]
end

🌸 DESCRIPTION 🌸

Okay so picture this: you're chillin' inside a loop that's currently running β€” a LOOP_CONSTRUCT, like a for loop or a while loop β€” and you're like "girl, I need OUT of here right now." That's literally what break does. It halts the loop mid-vibe. πŸ›‘

Most of the time you're not just yeeting it in there raw, though β€” you tuck it inside a conditional block, like an if block, so it only bails when something specific happens. Main character energy only. πŸ‘‘

Also, if you hit the -h or --help option, it displays help about using this command. Public service, honestly. 🫢


πŸŽ€ EXAMPLE πŸŽ€

So here's the scenario: we're searching all the .c files for "smurf", and we dip out at the first occurrence we find. No cap, first one and we're done. πŸ”

for i in *.c
    if grep smurf $i
        echo Smurfs are present in $i
        break
    end
end

See how the break lives inside the if? That's the move. It's giving "found my smurf, bye." πŸ“


πŸ’œ SEE ALSO πŸ’œ

  • the continue command β€” that one's for when you don't wanna leave the loop entirely, you just wanna skip the rest of the current iteration of the current inner loop. Different vibe, equally iconic. ⭐

fish-shell developers


and that's the tea, bestie β€” brought to you by fish-shell, version 4.9, dated Sep 08, 2026. go break out of a loop (responsibly) πŸ’…πŸŒˆ

πŸ“¦ where this page comes from
  • arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms