If...Then..Else Statement |
It conditionally executes a group of statements depending upon value of the expression. |
If...Then…Else block is used to define several blocks of statements ,in order to execute one block. |
Syntax: |
If |
[statements] |
Else if |
[else if statement] . . . |
Else |
[elsestatement] |
End If |
Example: |
If a<10 class="textbold">then |
a=a+10 |
elseif a>15 then |
a=a-10 |
else |
a=100 |
end if |
Note that: |
1.Both Else and ElseIf statements are optional. You can have any number of ElseIf statements as you want in an If block. But no ElseIf statement can appear after the Else. |
2.Block If statements can be nested. Nested means a block contained within one another. |
3.In fact If…Then is just a special case of If…then…Else. |
4.If none of ElseIf statement is True ,then the statement following Else will execute. |
Wednesday, February 25, 2009
If...Then..Else Statement
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment