DotNetWebTutor.com                                                    Link to Us

Conditional Operators


=

Is equal to

<> 

Not equal to

Less than

Greater than

<=

Less than or equal to

>=

Greater than or equal to

Conditionals
Logical Operators


And

Both conditions must be true

Or

Both or either condition can be true

Not

Returns the opposite of the Boolean condition

if
If condition Then statements [Else elsestatements]
Or
If condition Then
[statement]
[Else If condition-n Then
[elseif statements] ]…
[Else
[elsestatements] ]

End If

If (1=3) then
Do something
End if
select case
Select Case testexpression
[Case expressionlist-n
[statements-n] ] …
[Case Else expressionlist-n
[elsestatements-n] ]

End Select

Select case txtAnimal.text.toUpper()
Case”Dog”
Messagebox.show(“Woof”)
Case “Cat”
Messagebox.show(“Meow”)
Case else
Messagebox(“Hello”)
End select
for next
For counter = start To end [Step step]
[statement]
[Exit For]
[statement]

Next

foreach
For Each element In group
[statement]
[Exit For]
[statement]
Next [element]
do while


Do [ {While | Until } condition]
Do

     [statement]

     [statement]

[Exit Do]

[Exit Do]

     [statement]

     [statement]

[Loop]

Loop [ { While | Until } condition ]

end code