I'm putting together some simple code examples for a data structures course I'll be teaching in the fall. I wrote a trivial recursive factorial function
static int factorial (int n)
...obvious code goes here
and then inserted as a new first line
assert (n > 0);
the purpose being to introduce students to preconditions and so forth.
The little lightbulb popped up and suggested that I replace the 'assert' with an 'if' statement (see picture). Why?