Skip to content
Try Kata

native.ops

The interpreter’s native implementations of arithmetic, comparison, and truth testing.

All modules · Writing docstrings

func add(left, right)

Dispatches +; supported operands and result depend on their runtime types.

func sub(left, right)

Dispatches -; numeric operands must be compatible.

func mul(left, right)

Dispatches *; numeric operands must be compatible.

func div(left, right)

Dispatches /; rejects a zero divisor.

func mod(left, right)

Dispatches %; rejects a zero divisor and follows the divisor sign.

func eq(left, right): Bool

Dispatches equality, including cross-comparison between Int and Float.

func ne(left, right): Bool

Dispatches inequality.

func lt(left, right): Bool

Dispatches < for comparable numeric, string, byte, or char values.

func gt(left, right): Bool

Dispatches > for comparable numeric, string, byte, or char values.

func le(left, right): Bool

Dispatches <= for comparable numeric, string, byte, or char values.

func ge(left, right): Bool

Dispatches >= for comparable numeric, string, byte, or char values.

func neg(value)

Dispatches unary numeric negation.

func not(value)

Dispatches unary logical negation.

func truth(value): Bool

Returns KataScript truthiness: nil, false, zero numbers, empty strings, and empty tuples/records are false.