We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
008-loop.md の一番最後の factorial 関数の例ですが、
このコードは末尾再帰になっている。
とありますが、なってないように見えます。 私の知ってる末尾再帰は次のようなものです。
int factorial(int n, int acc=1) { if (n <= 1) { return acc; } else { return factorial(n - 1, n * acc); } } // => int factorial_loop(int n) { int acc = 1; while (true) { if (n <= 1) { return acc; } acc *= n; n--; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
008-loop.md の一番最後の factorial 関数の例ですが、
とありますが、なってないように見えます。
私の知ってる末尾再帰は次のようなものです。
The text was updated successfully, but these errors were encountered: