Document that break cannot be used in switch

This commit is contained in:
Mitchell Kember 2022-09-16 22:12:10 -07:00 committed by GitHub
parent d5561623aa
commit ee1018ab53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -17,7 +17,7 @@ Synopsis
Description Description
----------- -----------
``break`` halts a currently running loop (*LOOP_CONSTRUCT*), such as a :ref:`switch <cmd-switch>`, :ref:`for <cmd-for>` or :ref:`while <cmd-while>` loop. It is usually added inside of a conditional block such as an :ref:`if <cmd-if>` block. ``break`` halts a currently running loop (*LOOP_CONSTRUCT*), such as a :ref:`for <cmd-for>` or :ref:`while <cmd-while>` loop. It is usually added inside of a conditional block such as an :ref:`if <cmd-if>` block.
There are no parameters for ``break``. There are no parameters for ``break``.

View file

@ -19,6 +19,8 @@ Each ``case`` command is given one or more parameters. The first ``case`` comman
Note that fish does not fall through on case statements. Only the first matching case is executed. Note that fish does not fall through on case statements. Only the first matching case is executed.
Note that :ref:`break <cmd-break>` cannot be used to exit a case/switch block early like in other languages. It can only be used in loops.
Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter. Note that command substitutions in a case statement will be evaluated even if its body is not taken. All substitutions, including command substitutions, must be performed before the value can be compared against the parameter.