Member-only story
Solidity Tutorial: all about Functions

Table of Contents
Function visibility
View vs Pure
Named Arguments in Functions
Payable functions
Fallback functions
Receive functions
Functions overloading
Functions signature
External functions
Recursive Functions : preventing re-entrancy
Function Visibility
Introduction
Solidity is a high level language for the EVM. The EVM under the hood does what we call EVM calls, known as “message calls”. From a higher perspective, Solidity knows two kind of function calls:
- internal ones: do not create an EVM call
- external ones: create an EVM call
4 visibilities availables
There are 4 main visibilities that can be assigned to functions in Solidity.
Let’s look at them in more details:
public
: visible everywhere (within the contract itself and other contracts or addresses).
Therefore, it is part of the contract interface (ABI). It can be called internally or via messages.
private
: visible only by the contract it is defined in, not derived contracts.
These functions are not part of the contract interface (ABI).
NB: Everything that is inside a contract is visible to all observers external to the blockchain. Making something
private
only prevents other contracts from reading or modifying the information, but it will still be visible to the whole world outside of the blockchain.