Here is my function:
#let add-numbers(...nums) = {
let sum = 0
let num-list = (nums) // Convert arguments to a list
for num in num-list {
if num.type() == "int" or num.type() == "float" {
sum = sum + num
}
}
sum
}
// Test the function
#add-numbers(1, 2, "hello", 3, 4, "world", 5) // Expected output: 15
Typst throws an error: "cannot loop over argument"
at the for num in num-list
line.