VBScript Conditional Statements

Conditional Statements :

Conditional statements are accustomed to perform different activities for different decisions.
In VBScript we have four conditional statements:
  • If statement – executes a set of signal whenever a situation is true.
  • If…Then…Else statement – pick one of two units of lines to implement.
  • If…Then…ElseIf statement – pick one of numerous units of lines to implement.
  • Pick Case statement – pick one of numerous units of lines to implement.

If…Then…Else :

Use the If…Then…Else record if you intend to

  • perform some signal if a condition holds true
  • pick one of two blocks of signal to perform

If you intend to perform only one record each time a condition holds true, you can write the signal using one line:

If i=10 Then alert(“Hello”)

There’s number ..Else.. in that syntax. You just inform the rule to perform one activity if your problem is true (in that situation If i=10).
If you intend to execute several record whenever a problem is true, you have to put each record on split lines, and conclusion the record with the keyword “Conclusion If”:

If i=10 Then
alert(“Hello”)
i = i+1
End If


There is no ..Else.. in the example above either. You just tell the code to perform multiple actions if the condition is true.

Leave a Reply

Your email address will not be published. Required fields are marked *