Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

What conditional statement we used in VBScript?
 Conditional statements that we used in VBScript are given below:
1.if statement
2.if..than..else statement
3.if..than..elseif statement
4.select case statement
1.if statement: In if statement we execute a  statement when some condition is true.
Example:
if i=8 Then msgbox "Welcome".
 This code will execute only one time.

2.if..then..else statement: Used when we want to execute more than one statement when some condition is true.
Example:
if i=8 Then
   msgbox "Welcome"
   i = i+1
end If
 In the above code we can execute multiple statements when conditon is ture or using else can execute statement the condition is false.Like
that,
if i=8 then
   msgbox "Welcome"
else
   msgbox "Wait"
end If
 If conditon is true(i=8)it will display Welcome otherwise Wait.

3.if..then..elseif statement: We can use this type of statements when we want to execute more than one block of code.It can execute more than one statement whenever our condition is true or 
false.
Example:
if name="Abhi" then
   msgbox "Welcome Abhi!"
 elseif name="Jaleese" then
   msgbox "Welcome Jaleese!"
 elseif name="Shrish" then
   msgbox "Welcome Shrish!"
 else
   msgbox "R4R Welcomes You!"
end If

3.select case statements: using select statement we can execute more than one blocks of code.
Example:
select case name
 case "Abhi"
   msgbox "Welcome Abhi!"
 case "Jaleese"
   msgbox "Welcome Jaleese!"
 case "Shrish"
   msgbox "Welcome Shrish!"
 case Else
   msgbox "R4R Welcomes you!"
end select