0

Why should one use return =1 instead of 0?

the first lesson explained that any number more than 0 in return gives an error. So how come when learning factorials the example the return is given as 1 and not 0.

5th Nov 2016, 2:11 PM
vinod nair
vinod nair - avatar
2 ответов
0
Returning zero is only necessary for the main function, but every other function u create can return any number. If u were to return zero in the recursion function u would be multiplying by zero and ur output would then be zero
16th Dec 2016, 8:31 PM
Angelo Paparazzi
Angelo Paparazzi - avatar
- 1
factorials
5th Nov 2016, 2:54 PM
mutyal priyanka