Powershell-if-statement-in-powershell

提供:Dev Guides
移動先:案内検索

Powershell-Ifステートメント

*if* ステートメントは、ブール式とそれに続く1つ以上のステートメントで構成されます。

構文

ifステートメントの構文は次のとおりです-

if(Boolean_expression) {
  //Statements will execute if the Boolean expression is true
}

ブール式がtrueと評価されると、ifステートメント内のコードブロックが実行されます。 そうでない場合、ifステートメントの終了後(閉じ中括弧の後)の最初のコードセットが実行されます。

流れ図

Ifステートメント

$x = 10

if($x -le 20){
   write-host("This is if statement")
}

これは、次の結果を生成します-

出力

This is if statement.