Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skywalkw3r/33c7a8e3f71b7af9f5f57c598e6aa231 to your computer and use it in GitHub Desktop.
Save skywalkw3r/33c7a8e3f71b7af9f5f57c598e6aa231 to your computer and use it in GitHub Desktop.
function Get-Fahrenheit {
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline=$true,
Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidatePattern('^(\d*\.)?\d+$')]
[decimal]$CelsiusTemp
)
[PSCustomObject]@{
Fahrenheit = "$(($CelsiusTemp*1.8)+32)"
Celsius = "$CelsiusTemp"
}
}
function Get-Celsius {
[CmdletBinding()]
Param(
[Parameter(ValueFromPipeline=$true,
Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[ValidatePattern('^(\d*\.)?\d+$')]
[decimal]$FahrenheitTemp
)
[PSCustomObject]@{
Celsius = "$(($FahrenheitTemp-32)/1.8)"
Fahrenheit = "$FahrenheitTemp"
}
}
@skywalkw3r
Copy link
Author

Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment