How do you determine the type of a variable?

#let arr = ("abc", "def", "ghi")
#let dict = ("a": "c")

= Before 0.13.0
#str(if type(arr) == "array" { "true" } else { "false" })
#str(if type(arr) == "dictionary" { "true" } else { "false" })

= After 0.13.0
// what should i do?

// dict
#str(if type(dict) == type((:)) { "true" } else { "false" })

// array
// ??

Type to string comparisons were already deprecated and are now removed. You have to use the type directly (not the string), e.g. if type(arr) == array {...

5 Likes