Tutorial: specify match cases don't fall through (GH-93615)

This commit is contained in:
max 2022-06-21 21:44:09 +02:00 committed by GitHub
parent 51d673176a
commit dd5cf84f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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 A :keyword:`match` statement takes an expression and compares its value to successive
patterns given as one or more case blocks. This is superficially patterns given as one or more case blocks. This is superficially
similar to a switch statement in C, Java or JavaScript (and many similar to a switch statement in C, Java or JavaScript (and many
other languages), but it can also extract components (sequence elements or other languages), but it's more similar to pattern matching in
object attributes) from the value into variables. 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:: The simplest form compares a subject value against one or more literals::