2023-07-29 10:34:04 +02:00
|
|
|
*list-fibonacci.ps1*
|
|
|
|
================
|
2022-11-17 20:02:26 +01:00
|
|
|
|
|
|
|
list-fibonacci.ps1
|
2022-11-17 19:46:02 +01:00
|
|
|
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Parameters
|
|
|
|
----------
|
2022-11-17 19:46:02 +01:00
|
|
|
```powershell
|
|
|
|
|
|
|
|
|
|
|
|
[<CommonParameters>]
|
|
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
|
|
```
|
|
|
|
|
2023-07-29 10:04:38 +02:00
|
|
|
Script Content
|
|
|
|
--------------
|
2022-11-17 20:05:34 +01:00
|
|
|
```powershell
|
2022-11-17 20:02:26 +01:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Lists the Fibonacci numbers
|
|
|
|
.DESCRIPTION
|
|
|
|
This PowerShell script lists the Fibonacci numbers.
|
|
|
|
.EXAMPLE
|
|
|
|
PS> ./list-fibonacci
|
|
|
|
.LINK
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
.NOTES
|
|
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
#>
|
|
|
|
|
|
|
|
function fibonacci($n) {
|
|
|
|
if ($n -lt 2) { return 1 }
|
|
|
|
return (fibonacci($n - 1)) + (fibonacci($n - 2))
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($i in 0..100) {
|
|
|
|
Write-Host "$(fibonacci $i), " -noNewline
|
|
|
|
}
|
|
|
|
exit 0 # success
|
2022-11-17 20:05:34 +01:00
|
|
|
```
|
2022-11-17 20:02:26 +01:00
|
|
|
|
2023-07-29 10:34:04 +02:00
|
|
|
*(generated by convert-ps2md.ps1 using the comment-based help of list-fibonacci.ps1 as of 07/29/2023 10:33:46)*
|