Wednesday 23 January 2013

Vb.net For Statements & Loops

For Statements:

The Basic For Statement Looks like this:

Dim i As Long = 0
Dim x As Long = 0

For i = 0 To 10
x +=2
Next

MsgBox(x.ToString)

While Statements

Dim i As Long = 0
Dim ExitMe As Boolean = False

While ExitMe = False
i +=1
If i = 10 Then
ExitMe = True
End If
End While

Do Until

Dim i As Long = 10
Do Until (i < 0)
i-=1
loop

No comments:

Post a Comment