Should a check for null occur before making the call to a function or within the function itself?
I would say within the call itself. That way, you only check for null in one place, not 5 places if you call that function from 5 different spots.
But this isn't a for sure answer. It really depends on the function and what the consequences are of calling it with a null argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With