Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Doc/tutorial/controlflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ other languages), but it's more similar to pattern matching in
languages like Rust or Haskell. Only the first pattern that matches
gets executed and it can also extract components (sequence elements
or object attributes) from the value into variables.
If no case matches, none of the branches is executed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put this line as the line above:

gets executed and it can also extract components (sequence elements
or object attributes) from the value into variables. If no case matches,
none of the branches is executed.


The simplest form compares a subject value against one or more literals::

Expand All @@ -305,7 +306,7 @@ The simplest form compares a subject value against one or more literals::
return "Something's wrong with the internet"

Note the last block: the "variable name" ``_`` acts as a *wildcard* and
never fails to match. If no case matches, none of the branches is executed.
never fails to match.

You can combine several literals in a single pattern using ``|`` ("or")::

Expand Down
Loading