checkedSub (Function)

Signature: checkedSub(a: int, b: int) -> Result<int, Error>

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

Parameters

  • a (int): The minuend
  • b (int): The subtrahend

Returns: Result<int, Error>

Example

let d = checkedSub(a: 10, b: 4) ?: 0  // 6
d = checkedSub (a: 10, b: 4) ?: 0  // 6