PowerShell - leap, raindrops, reverse-string, two-fer

This commit is contained in:
Xevion
2021-11-26 02:28:45 -06:00
parent e02f2ceabf
commit 3bd08f4c92
29 changed files with 569 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
Function Get-TwoFer(){
<#
.SYNOPSIS
"Two-fer" is short for two for one. One for you and one for me.
.DESCRIPTION
If the given name is "Alice", the result should be "One for Alice, one for me."
If no name is given, the result should be "One for you, one for me."
.PARAMETER Name
The name to use.
.EXAMPLE
Get-TwoFer
Will return: One for you, one for me
.EXAMPLE
Get-TwoFer -Name Alice
Will return: One for Alice, one for me
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false, Position=0)]
[string]$Name
)
# if ($Name -eq $null -or $Name.Length -eq 0) { $Name = 'you'}
if ([string]::IsNullOrEmpty($Name)) { $Name = 'you' }
return "One for $($Name), one for me"
}