this is my first post and I am pretty new to programming and working my way through learning solidity with the help of freeCodeCamp on Youtube right now. At around 1:48:00 in this video (https://www.youtube.com/watch?v=M576WGiDBdQ) the author introduces the retrieve function which basically has the same functionality of the statement in contract, right? When both of them lead to the same result, why would using the retrieve function be necessary in this case? Isn't this function just going to waste space? Or which advantages does it provide? Unfortunately he doesn't explain it and it's confusing me like hell. Kind regards
contract SimpleStorage {
uint256 favoriteNumber;
function retrieve() public view returns (uint256) {
return favoriteNumber;
}
}