Do you test edge cases?

Often when we learn programming, we are never taught to think outside the box. Yes, we are given some set of requirements, and a vision of what to build. It is our job as Software Engineers to build that product.
So you folks might have heard of this, famous code to find factorial of a number, the recursive method.

int factorial(int n)
{ int ans = 1; if(n == 0 || n == 1) { return 1; } ans = n * factorial(n-1); return ans;
}
Enter fullscreen mode
Exit fullscreen mode

Question: What happens when we enter negative number?

A penny for your thoughts


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
, top mistakes to avoid professional guide 2024 selecting th…. Allows using the site with your screen reader.