[Tips or Advice] Do we need to check assumptions?

Hi. This is just a general doubt about programming (and I think it fit with this topic).​​

For example, if I have a function that assume that the input parameter will be always a number > 0​, do I need to check inside function if the number is > 0? And what to do if the numer is <= 0?.. although, at first, that case (<=0) should not occur. Throw an exception, or control the exception?​…

Thanks in advance! :wink:

Privacy & Terms