PoshCode Archive  Artifact [3cc042966b]

Artifact 3cc042966b3783082041aeb4011e8c67e13a6c0a5ac68c7064643099ceb99d42:

  • File ConvertFrom-FahrenheitWi.ps1 — part of check-in [31268d8dc3] at 2018-06-10 13:05:37 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: 2135
# x-archived: 2016-05-17T14:20:31
# x-published: 2011-09-09T21:40: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."