I wish to display “teacher” when array length = 1, else “teachers”
The following snippet does not work in vscode:
#let team = [1, 2, 3, ]
#if team.len == 1 { "teacher" } else { "teachers" }
here is the command i ran to compile. I am using typst 0.13.1
PS C:\Users\user\typst> typst compile .\main2.typ
error: sequence does not have field "len"
┌─ \\?\C:\Users\user\typst\main2.typ:3:9
│
3 │ #if team.len == 1 { "yes" } else { "asdadaaa" }
│ ^^^
PS C:\Users\user\typst> typst --help
Typst 0.13.1 (8ace67d9)
even after changing to
#let team = (1, 2, 3, )
#if team.len == 1 { "yes" } else { "asdadaaa" }
it still does not work :
PS C:\Users\user\typst> typst compile .\main2.typ
error: cannot access fields on type array
┌─ \\?\C:\Users\user\typst\main2.typ:2:9
│
2 │ #if team.len == 1 { "yes" } else { "asdadaaa" }
│ ^^^