pub fn try_add(left_value: u128, right_value: u128) -> Option<u128>
Expand description
The function try_add
in Rust attempts to add two u128
values and returns Some(result)
if an
overflow occurs, otherwise it returns None
.
Arguments:
left_value
: Theleft_value
parameter is a 128-bit unsigned integer (u128) representing the left operand in the addition operation.right_value
: Theright_value
parameter in thetry_add
function represents the value that will be added to theleft_value
parameter.
Returns:
The function try_add
returns an Option<u128>
. If the sum of left_value
and right_value
overflows, it returns Some(result_add)
with the overflowed value. Otherwise, it returns None
.