Difference between revisions of "If a number lies between two values"

From MyWiki
Jump to: navigation, search
(Created page with "<sourcs lang = "Powershell"> $numLow = 1 $numHigh = 10 $testNum = 5 if(($testNum -gt $numLow) -and ($testNum -lt $numHigh)) { Write-Host "Number $testNum is between the...")
 
 
Line 1: Line 1:
<sourcs lang = "Powershell">
+
<source lang = "Powershell">
 
$numLow = 1
 
$numLow = 1
 
$numHigh = 10
 
$numHigh = 10

Latest revision as of 16:53, 16 December 2022

$numLow = 1
$numHigh = 10
 
$testNum = 5
 
if(($testNum -gt $numLow) -and ($testNum -lt $numHigh))
{
    Write-Host "Number $testNum is between the range."
}
else
{
    Write-Host "Number $testNum is outside of the range."
}