8000 [3.11] Tutorial: specify match cases don't fall through (GH-93615) by miss-islington · Pull Request #94083 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.11] Tutorial: specify match cases don't fall through (GH-93615) #94083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Changes from all 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
Tutorial: specify match cases don't fall through (GH-93615)
(cherry picked from commit dd5cf84)

Co-authored-by: max <36980911+pr2502@users.noreply.github.com>
  • Loading branch information
pr2502 authored and miss-islington committed Jun 21, 2022
commit f05b2f5b41694a51aa0fdd4b6dc552e4ff345ab8
6 changes: 4 additions & 2 deletions Doc/tutorial/controlflow.rst
67A2
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ at a more abstract level. The :keyword:`!pass` is silently ignored::
A :keyword:`match` statement takes an expression and compares its value to successive
patterns given as one or more case blocks. This is superficially
similar to a switch statement in C, Java or JavaScript (and many
other languages), but it can also extract components (sequence elements or
object attributes) from the value into variables.
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.

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

Expand Down
0