To start with, https://docs.soliditylang.org/en/latest/solidity-by-example.html contains the most important examples.
Unless a function is called from within the contract, there is no need for it to be public. Changing it to external is clearer and should be recommended to the users.