Skip to content

Commit

Permalink
Tutorial: specify match cases don't fall through (pythonGH-93615)
Browse files Browse the repository at this point in the history
  • Loading branch information
pr2502 authored Jun 21, 2022
1 parent 51d6731 commit dd5cf84
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Doc/tutorial/controlflow.rst
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 comments on commit dd5cf84

Please sign in to comment.