Rajesh’s Weblog

Just another WordPress.com weblog

While Loop

Posted by arajesh on April 4, 2008

Exit from While Loop

Imports System

Public Class MainClass

Shared Sub Main(ByVal args As String())
Dim counter As Integer

While counter <= 10
‘ skip remaining code in loop only if counter = 7
If counter = 7 Then
Exit While
End If

counter += 1
End While

Console.WriteLine( “counter = ” & counter & _
” after exiting While structure”)

End Sub
End Class

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>