END(1) fish-shell END(1)

# [NAME](#NAME)

end - end a block of commands

# [SYNOPSIS](#SYNOPSIS)

```
begin


    [COMMANDS ...]
end
```

```
function NAME [OPTIONS]; COMMANDS ...; end
if CONDITION; COMMANDS_TRUE ...; [else; COMMANDS_FALSE ...;] end
switch VALUE; [case [WILDCARD ...]; [COMMANDS ...]; ...] end
while CONDITION; COMMANDS ...; end
for VARNAME in [VALUES ...]; COMMANDS ...; end
```

# [DESCRIPTION](#DESCRIPTION)

The **end** keyword ends a block of commands started by one of the following commands:

- begin &lt;&gt; to start a block of commands
- function &lt;&gt; to define a function
- if &lt;&gt;, switch &lt;&gt; to conditionally execute commands
- while &lt;&gt;, for &lt;&gt; to perform commands multiple times

The **end** keyword does not change the current exit status. Instead, the status after it will be the status returned by the most recent command.

# [Copyright](#Copyright)

fish-shell developers

October 10, 2026 4.9

---

Document: end(1) from fish 4.9.3-r1 (Chainguard OS)
Source: https://github.com/fish-shell/fish-shell
