Factry Historian
...
Scripting
Runtime Types
tengo runtime types int signed 64bit integer string string float 64bit floating point bool boolean char character ( rune in go) bytes byte array ( \[]byte in go) array objects array ( \[]object in go) immutablearray immutable object array ( \[]object in go) map objects map with string keys ( map\[string]object in go) immutablemap immutable object map with string keys ( map\[string]object in go) time time ( time time in go) error an error with underlying object value of any type undefined undefined 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 /#objectisfalsy 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) int n == 0 string len(s) == 0 float isnan(f) bool !b char c == 0 bytes len(bytes) == 0 array len(arr) == 0 map len(map) == 0 time time iszero() error true (error is always falsy) undefined true (undefined is always falsy) type conversion builtin functions string(x) tries to convert x into string; returns undefined if failed int(x) tries to convert x into int; returns undefined if failed bool(x) tries to convert x into bool; returns undefined if failed float(x) tries to convert x into float; returns undefined if failed char(x) tries to convert x into char; returns undefined if failed bytes(x) tries to convert x into bytes; returns undefined if failed bytes(n) as a special case this will create a bytes variable with the given size n (only if n is int) time(x) tries to convert x into time; returns undefined if failed see builtin functions docid\ uufozxxguzpcbsx61qiqb for the full list of builtin functions type checking builtin functions is string(x) returns true if x is string; false otherwise is int(x) returns true if x is int; false otherwise is bool(x) returns true if x is bool; false otherwise is float(x) returns true if x is float; false otherwise is char(x) returns true if x is char; false otherwise is bytes(x) returns true if x is bytes; false otherwise is array(x) return true if x is array; false otherwise is immutable array(x) return true if x is immutable array; false otherwise is map(x) return true if x is map; false otherwise is immutable map(x) return true if x is immutable map; false otherwise is time(x) return true if x is time; false otherwise is error(x) returns true if x is error; false otherwise is undefined(x) returns true if x is undefined; false otherwise see builtin functions docid\ uufozxxguzpcbsx61qiqb for the full list of builtin functions