Nothing. With the braces in place, what follows the
else
is a block statement containing one statement.
Without the brackes, what follows the
else
is the one statement contained in the block.
Here is a Javascript version of the factorial calculator:
Try some values for N that test the boundaries: -1, 0, 1. Then try some small values like 6 or 12.
Try a value of 25. Something surprising happens. The the result is very, very large! It is so large that it is expressed in scientific notation. JavaScript (in which this program is written) automatically does this. Java does not do this, so there is an important difference in how this program behaves and how the Java program behaves. If you need the values of large factorials, use a double precision variable for fact. This is not completely satisfactory, however, because it is not completely accurate (double precision floating point values have only about 15 decimal digits of accuracy).