PoshCode Archive  Artifact [6660a2bd14]

Artifact 6660a2bd14767d127dd3c98b0ec8d126b8e50ac578039d69a4688d5605a8c09c:

  • File ConvertFrom-FahrenheitWi.ps1 — part of check-in [722f21cbe2] at 2018-06-10 13:10:40 on branch trunk — From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes (user: Lee Holmes size: 804)

# encoding: ascii
# api: powershell
# title: ConvertFrom-FahrenheitWi
# description: From Windows PowerShell Cookbook (O’Reilly) by Lee Holmes
# version: 1.8
# type: function
# author: Lee Holmes
# license: CC0
# x-poshcode-id: 2459
# x-archived: 2016-03-18T23:50:03
# x-published: 2011-01-17T05:06:00
#
#
## From Windows PowerShell Cookbook (O'Reilly)
## by Lee Holmes (http://www.leeholmes.com/guide)

param([double] $Fahrenheit)

Set-StrictMode -Version Latest

## Convert Fahrenheit to Celsius
function ConvertFahrenheitToCelsius([double] $fahrenheit)
{
    $celsius = $fahrenheit - 32
    $celsius = $celsius / 1.8
    $celsius
}

$celsius = ConvertFahrenheitToCelsius $fahrenheit

## Output the answer
"$fahrenheit degrees Fahrenheit is $celsius degrees Celsius."