|
|
|
|
|
by Willamin
976 days ago
|
|
A bit of a nitpick on the language on the homepage: The description of the Fibonacci example seems incorrect, but I might be misunderstanding something about the language. > A fib evaluation function was defined using recursion. > The result of the function call was assigned to a variable named "result" and format the output using fmt.printf import fmt
fn fib(int n):int {
if n <= 1 {
return n
}
return fib(n - 1) + fib(n - 2)
}
fmt.printf('fib result is %d', fib(30))
No variable named "result" is ever defined, right? Maybe the description is outdated from a time when an intermediate variable was present. |
|