assert_ne

The assert_ne function is automatically imported into every program from the prelude. It takes two expressions which are compared and the result is a Boolean. If the value is false then the virtual machine will revert.

Example

Here is a function which asserts that a and b must not be equal.

fn compare_ne(a: u64, b: u64) {
    assert_ne(a, b);
    // code
}