mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-07 13:15:05 -06:00
PowerShell - leap, raindrops, reverse-string, two-fer
This commit is contained in:
32
powershell/two-fer/TwoFer.ps1
Normal file
32
powershell/two-fer/TwoFer.ps1
Normal 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"
|
||||
}
|
||||
Reference in New Issue
Block a user