Function try_add

Source
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: The left_value parameter is a 128-bit unsigned integer (u128) representing the left operand in the addition operation.
  • right_value: The right_value parameter in the try_add function represents the value that will be added to the left_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.