Skill 2.1.3
Declare functions with appropriate visibility and state mutability
Key Concepts
Function visibility is public (callable externally and internally), external (callable only from outside, or with this.f()), internal (this contract and derived contracts, the default for state variables) or private (only this contract). A public state variable gets an automatic getter function.
State mutability describes what a function does with state. A view function reads but does not modify state; a pure function neither reads nor modifies it; a payable function may receive ether with the call. A function without a mutability keyword can modify state but rejects ether. Calling view and pure functions from outside a transaction costs no gas.