|
|
|
|
|
by guiomie
4419 days ago
|
|
First of all, let me say this is something I've wanted for a while, so good job and thank you to the author. When I try the Tutorial.csx, I can't get this snippet to work: static class MyMath
{
public static long Fibonacci(long n)
{
//anything more than 48 will result in a stack overflow.
if (n >= 48) throw new ArgumentException("Enter a number less than 48");
if (n == 0) return 0;
if (n == 1) return 1;
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
} // Now the method can be called like so:
MyMath.Fibonacci(12); It gives me : "(14,0): error CS1525: Unexpected symbol `MyMath'" in the repl, anyone knows why? |
|
Anyhow what you need to do is simply select line 35-45 with your cursor, then press Alt+Enter.
And then, after that, execute MyMath.Fibonacci(12);