diff --git a/civet.dev/reference.md b/civet.dev/reference.md index 8d385c06..ce835879 100644 --- a/civet.dev/reference.md +++ b/civet.dev/reference.md @@ -1631,9 +1631,7 @@ switch x console.log "leading type:", type -::: info -You can also use condition fragments as patterns. -::: +You can also use condition fragments as patterns: switch x @@ -1647,21 +1645,19 @@ switch x console.log "it's something else" +You can add a binding before a condition fragment: + -switch x - % 15 is 0 - console.log "fizzbuzz" - % 3 is 0 - console.log "fizz" - % 5 is 0 - console.log "buzz" - else - console.log x +switch f() + x % 15 is 0 + console.log "fizzbuzz", x + x % 3 is 0 + console.log "fizz", x + x % 5 is 0 + console.log "buzz", x -::: info -Aliasing object properties works the same as destructuring. -::: +Aliasing object properties works the same as destructuring: switch e @@ -1669,9 +1665,7 @@ switch e return [type, eventKey] -::: info -Patterns can aggregate duplicate bindings. -::: +Patterns can aggregate duplicate bindings: switch x @@ -2325,10 +2319,13 @@ You can also specify multiple `catch` blocks using try foo() +catch e