checkedAdd (Function)

Signature: checkedAdd(a: t0, b: t0) -> Result<t0, Error>

Description: Named overflow-checked integer addition, returning Result<int, Error>.

Parameters

  • a (t0): The first addend
  • b (t0): The second addend

Returns: Result<t0, Error>

Example

let t = checkedAdd(9223372036854775807, 1) ?: 0  // 0: overflow reported
t = checkedAdd (9223372036854775807, 1) ?: 0  // 0: overflow reported