Go support for programmers familiar with other common programming languages, such as C/C++, Java, Javascript, Python.
Cond(a, b, c)
: Conditional operatora ? b : c
Null(a, b)
: Nil-checking operatora ?? b
i. e.a!=nil ? a : b
Value(value, error)
: Returns the error if so, value if not.- Case to Boolean type:
Bool(v)
- Numbers: whether
v
is non-zero; - Strings: whether
v
is non-empty; nil
-Testible Objects viz. pointer, channel, function, interface, map, and slice types:nil
tofalse
, others totrue
;- Arrays and structures: always true as for JavaScript empty array
[]
and empty object{}
.
- Numbers: whether