Repeat a block of statements.
Syntax If condition Then [Statements] [Else Else-Statements] or If condition Then [Statements] [ElseIf condition-n] Then [Statements] [Else] [Statements] End If Key condition An expression that evaluates to True or False Statements Program code to be executed if condition is True
hournow = hour(Time()) If hournow > 12 Then WScript.Echo "Good Afternoon" Dim strCountry strCountry = "USA" If strCountry = "USA" Then WScript.Echo "United States of America." ElseIf strCountry = "CA" Then WScript.Echo "Canada." Else WScript.Echo "Some other country." End If
“You have to learn the rules of the game. And then you have to play better than anyone else” ~ Albert Einstein
Select...Case - Conditional execution of a block of code
Do..Loop - Repeat a block of statements
While...Wend - Conditionally repeat a block of statements
Equivalent in PowerShell: If