When to use a variable vs simple value returning function

Awesome reply, thanks

Could you please elaborate on this? I come from jsland and in most codebases it appears the convention is to stick all variables at the top of the scope.