- revert() works just like the require() function, but use it for more complex conditions:
if (msg.sender != owner) { revert(); }
- revert also uses the 0xfd opcode to raise exceptions, so it supports the return message and gas refund functionalities:
if (!condition) { revert("Error Message");}
- If you have complex nested if-else control flow statements, use the revert() method instead of the require() method.
- Both require and revert functions should be used more often. They are generally used at the beginning of a function.