require function
Throws an exception with the provided exception
message if the given requirement
is not met.
requirement
: The condition to check.exception
: The exception message to throw if the requirement is not met.
Implementation
require(bool requirement, String exception) {
if (!requirement) {
throw Exception(exception);
}
}