pub fn assert(condition: bool) Expand description
Asserts that the given condition will always be true during runtime.
Additional Information
To check for conditions that may not be true, use std::revert::require instead.
For more information, see the Wiki article on Assertion.
Arguments
condition: [bool] - The condition which will be asserted to betrue.
Reverts
- Reverts when
conditionisfalse.
Examples
fn foo(a: u64, b: u64) {
assert(a == b);
// if code execution continues, that means a was equal to b
log("a is equal to b");
}