diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-09-30 19:07:06 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-09-30 19:07:06 +0200 |
| commit | 6d26e15fbe9a91bcae9cc98fab0743ca75c41ea7 (patch) | |
| tree | 539e99da077e3c9c3b64ebac791ca2c38e65e4fd /tests/typ | |
| parent | 9e9550262232158328ed7ccb2b620674e5015efc (diff) | |
Support `else if`
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/code/if.typ | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/typ/code/if.typ b/tests/typ/code/if.typ index 36fd3d0f..3b3164fc 100644 --- a/tests/typ/code/if.typ +++ b/tests/typ/code/if.typ @@ -45,6 +45,33 @@ if "template" == type [Nope] else [ve.] } +#let i = 3 +#if i < 2 [ + Five. +] else if i < 4 [ + Six. +] else [ + Seven. +] + +--- +// Test else if. +// Ref: false + +#let nth(n) = { + str(n) + (if n == 1 { "st" } + else if n == 2 { "nd" } + else if n == 3 { "rd" } + else { "th" }) +} + +#test(nth(1), "1st") +#test(nth(2), "2nd") +#test(nth(3), "3rd") +#test(nth(4), "4th") +#test(nth(5), "5th") + --- // Value of if expressions. // Ref: false |
