Conditional branch
April 18, 2025Less than 1 minuteblueprintvbsbranch
if
单分支
输入:
let age: num = 10
if $age > 18 {
echo "you are an adult"
}
输出:
Dim age
age = 10
If age > 18 Then
MsgBox "you are an adult"
End If
多分支
输入:
$score := 60
if $score > 90 {
echo "Grade: excellent"
} else if $score > 75 {
echo "Grade: good"
} else if $score > 60 {
echo "Grade: Pass"
} else {
echo "Grade: fail"
}
输出:
score = 60
If score > 90 Then
WScript.Echo "Grade: excellent"
ElseIf score > 75 Then
WScript.Echo "Grade: good"
ElseIf score > 60 Then
WScript.Echo "Grade: Pass"
Else
WScript.Echo "Grade: fail"
End If
命令
if ! cmd {
echo "cmd not found"
}
if $(cmd) == "0" {
echo "successfully to execute"
}