try_add

Adds two UINT256 values. Arithmetic overflow produces NULL; independently, ordinary scalar NULL propagation produces NULL when either input is NULL.

Scalar function TypesEVM

Example

Runs locally

SELECT try_add(40::UINT256, 2::UINT256)::VARCHAR AS result;
-- => [{"result":"42"}]

API reference

try_add(UINT256, UINT256) #

Returns a + b when it fits UINT256, otherwise NULL.

Inputs

Name Type Use
a UINT256

UINT256 addend.

required positional
b UINT256

UINT256 addend.

required positional

Returns

Name Type
sum UINT256

Checked sum. UINT256 sum, or NULL for arithmetic overflow or an input NULL.