new--If ... Else in PowerShell
if … else … Statement Syntax
CODE
if(Boolean_expression) {
// Executes when the Boolean expression is true
}else {
// Executes when the Boolean expression is false
}
Examples
CODE
$x = 30
if($x -le 20){
write-host("This is if statement")
}else {
write-host("This is else statement")
}
Output: This is else statement