Open
Description
This code, which recursively computes the 10th Fibonacci number:
$result = ($fib = function($n) use (&$fib) {
return $n <= 1 ? $n : $fib($n - 1) + $fib($n - 2);
})(10);
is incorrectly simplified to this:
$result = $fib = function ($n) use (&$fib) {
return $n <= 1 ? $n : $fib($n - 1) + $fib($n - 2);
}(10);
removing the parentheses leads to incorrect code.
Metadata
Metadata
Assignees
Labels
No labels