One thing to take care about is the usage of a function instead of a variable.Since some script could run other scripts dinamically, you can't trust in a single time check.

The second trick is really useful for function that accept a switcher argument.For switcher argument I mean methods or function that accept true or false as argument.The simplest way to have a switcher is obviously sending the value, but in this case we can't have a default behaviour.