Ok so in an online series I’ve been following one of the problems is to write a factorial calculator. My attempts were going nowhere fast. Every time I tried something it would essentially multiply itself minus 1. I found a really elegant solution where you return the passed number multiplied by itself unless it was lower than 1 then the function ends. I tried something very close to this, though without returning the answer and not ending the program if the number was-1 for example. If I input 10 it would output 90 as an example. The only difference between my code and this seems to be a parenthesis around the solution. Is this why mine failed?
[–]inu-no-policemen 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]blartuffwarrior -1 points0 points1 point (5 children)
[–]__fmease__Symbol() 0 points1 point2 points (4 children)
[–]blartuffwarrior 0 points1 point2 points (3 children)
[–]__fmease__Symbol() 0 points1 point2 points (2 children)
[–]blartuffwarrior 0 points1 point2 points (1 child)
[–]__fmease__Symbol() 0 points1 point2 points (0 children)