runtime types

Type Conversion/Coercion Table

src\dst Int String Float Bool Char Bytes Array Map Time Error Undefined
Int - strconv float64(v) !IsFalsy() rune(v) X X X time.Unix() X X
String strconv - strconv !IsFalsy() X []byte(s) X X X X X
Float int64(f) strconv - !IsFalsy() X X X X X X X
Bool 1 / 0 “true” / “false” X - X X X X X X X
Char int64(c) string(c) X !IsFalsy() - X X X X X X
Bytes X string(y) X !IsFalsy() X - X X X X X
Array X “[…]” X !IsFalsy() X X - X X X X
Map X “{…}” X !IsFalsy() X X X - X X X
Time X String() X !IsFalsy() X X X X - X X
Error X “error: …” X false X X X X X - X
Undefined X X X false X X X X X X -

* X: No conversion; Typed value functions for Variable will return zero values.
* strconv: converted using Go’s conversion functions from strconv package.
* IsFalsy(): use Object.IsFalsy() function
* String(): use Object.String() function * time.Unix(): use time.Unix(v, 0) to convert to Time

Object.IsFalsy()

Object.IsFalsy() interface method is used to determine if a given value should evaluate to false (e.g. for condition expression of if statement).

Type Conversion Builtin Functions

Type Checking Builtin Functions