Hello! I understand the essence of this algorithm, but I can not figure out why if you remove the return in front of x in the recursive function, then the answer becomes incorrect. How does return work in this example, and why not do without it?
#include <iostream> int fact(int x) { if (x == 1) return 1; return x * fact(x - 1); } int main() { std::cout << fact(5) << std::endl; system("pause"); return 0; }
returnin this programming language? - Igor