From 6387537792cfc96fb0a2e3d1f329a6c979883fa2 Mon Sep 17 00:00:00 2001 From: JesusValera Date: Fri, 10 Jun 2022 17:11:35 +0200 Subject: [PATCH] Add match section --- spec.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/spec.md b/spec.md index 66dbad4..a0166b5 100644 --- a/spec.md +++ b/spec.md @@ -710,7 +710,7 @@ if ( } ``` -### 5.2 `switch`, `case` +### 5.2 `switch`, `case`, `match` A `switch` structure looks like the following. Note the placement of parentheses, spaces, and braces. The `case` statement MUST be indented once @@ -757,6 +757,19 @@ switch ( } ``` +Similarly, a `match` expression looks like the following. Note the placement +of parentheses, spaces, and braces. + +```php + 'First case', + 1, 2, 3 => multipleCases(), + default => 'Default case', +}; +``` + ### 5.3 `while`, `do while` A `while` statement looks like the following. Note the placement of