Updated list-fibonacci.ps1

This commit is contained in:
Markus Fleschutz 2024-10-28 14:20:47 +01:00
parent 8a33a05610
commit b6e703d96e

View File

@ -12,13 +12,13 @@
Author: Markus Fleschutz | License: CC0
#>
function fibonacci($n) {
function fibo([int]$n) {
if ($n -lt 2) { return 1 }
return (fibonacci($n - 1)) + (fibonacci($n - 2))
return (fibo($n - 1)) + (fibo($n - 2))
}
foreach ($i in 0..100) {
Write-Host "$(fibonacci $i), " -noNewline
Write-Host "$(fibo $i), " -noNewline
}
exit 0 # success