Exception Handling
The exception handling mechanism in solidity is defined for handling cases when the error is made on the user’s end like invalid inputs, or even validate a condition.
- revert: Used when we want to revert the state of smart contract back to how it was, in case exception conditions arise.
- required: It enforces a condition satisfying mechanism to ensure a certain condition is met before a piece of code is executed. (Input validation mechanism)
- assert: unlike revert and required, assert is used to pre-enforce conditions. Suitable for conditions that should NEVER Occur.
Unlock the Power of Solidity: Exploring the Essential Keywords for Smart Contract Development
Solidity is a smart contract programming language built solely to develop smart contracts that can be deployed on blockchains. C++ and JavaScript inspired it, an Object Oriented and High-Level language (HLL), that helps developers define the behaviour and rules for a Decentralized Application (Dapp). Smart contract facilitates autonomous, secure, and efficient transaction execution on the blockchain without needing any intermediary (self-executable) and solidity provides the base framework for achieving the same.
It is essential to understand the common keywords used in solidity to solidify your core understanding of the language so in this article, we’ll pin down some prominent keywords that help us develop these smart contracts by embracing the true power of solidity language.
Table of Content
- Contract
- Constructor
- Data Types
- Delete
- Enum
- Function
- Interface
- Import
- Struct
- Visiblity Specifiers
- Exception Handling
- Pragma Directive
- License Defintion
- Modifier
- Data Location
- Global Variables
- Fallback Function
- SelfDestruct
- ‘assembly’ and ‘inline assembly’