Skip to content

Commit

Permalink
Use one liner as recommended by @lionello
Browse files Browse the repository at this point in the history
  • Loading branch information
hardliner66 committed May 1, 2016
1 parent 045e41b commit 72dd35b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions std/functional.d
Original file line number Diff line number Diff line change
Expand Up @@ -1067,8 +1067,7 @@ unittest
{
ulong fib(ulong n)
{
if (n == 0) return 0;
return n < 2 ? 1 : memoize!fib(n - 2) + memoize!fib(n - 1);
return n < 2 ? n : memoize!fib(n - 2) + memoize!fib(n - 1);
}
assert(fib(10) == 55);
}
Expand Down

0 comments on commit 72dd35b

Please sign in to comment.