summaryrefslogtreecommitdiff
path: root/tests/typ/code/if.typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/code/if.typ')
-rw-r--r--tests/typ/code/if.typ27
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