Undefined

undefined is Tengo's zero value — a distinct type returned by functions that do not explicitly return, and by missing map lookups.

fmt := import("fmt")
nothing := func() {}
result := nothing()
fmt.println(is_undefined(result))
m := {name: "Tengo"}
fmt.println(is_undefined(m["missing"]))
fmt.println(is_undefined(m["name"]))
fmt.println(type_name(result))
lookup := func(m, key) {
    val := m[key]
    if is_undefined(val) {
        return "not found"
    }
    return val
}
fmt.println(lookup(m, "name"))
fmt.println(lookup(m, "missing"))

try it

true
true
false
undefined
Tengo
not found
loading…