soma.cell

Type conversion

Type conversion, in the reference of the Soma programming language (soma 3.2.4). A block marked ✓ is a whole program that soma check accepts; the others are excerpts.

to_int("42")        // 42
to_int("abc")       // () — returns null, not 0
to_int(3.7)         // 3
to_float(42)        // 42.0
to_string(42)       // "42"
type_of(42)         // "Int"
is_type(rec, "User") // true if rec's _type field is "User", or rec is a variant named User / of sum type User (alias: is_a)