Common errors you may have while writing smart contracts with Solidity
If you are writing an smart contract you absolutely don't want to have any errors in it that might compromise your project. Here I'll introduce some of the most common mistakes people make while coding with Solidity.
- Syntax errors
Like all programing languages, syntax errors are common mistakes, specially for programers inexperienced in that particular language. You will get the hang of it if you practice enough. Example: missing a semi-colon. - No defining a function's type
All functions need a type to determine their scope and what they can manipulate and have access to. The type of a function can be either view, pure or payable. - No defining a function as internal or external
Internal functions can only be called within the smart contract they are defined in, while external functions can be called from other smart contracts and through web3 calls. - Not returning the correct type for a function
- Not providing a reference type for arguments or variables in a function
This types can be either memory, callable or storage.