Conditionals


Conditional expressions are used to control the order of the command execution in the program.

VBScript contains following conditional operators:

1.If … Then … Else

 If DatePart("w", Now) = vbWednesday Then

   S = "Wednesday"

 Else

   S = "Not Wednesday "

 End If

2.Case … Select

 Dim S

 Select Case DatePart("w", Now)

   Case vbMonday

     S = "Monday"

   Case vbTuesday

     S = " Tuesday "

   Case vbWednesday

     S = " Wednesday "

   ...

   Case Else

     Err.Raise 32000, "", "Unknown day"

 End Select