Language Syntax
Pattern as — Python syntax
Match the left pattern and bind the entire subject to the name when successful. The target is a capture name, not underscore; it is distinct from names bound within the subpattern.
Formal Syntax & Structure
python syntaxpython
case pattern as name: suiteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| pattern | pattern | Subpattern to match. |
| name | identifier | Capture of entire subject. |
Working Example
Example Snippetpython
match ('ok',7): case ('ok',n) as whole: result=n,wholeprint(result)