Your SlideShare is downloading. ×
0
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Looping statement in vb.net
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Looping statement in vb.net

14,664

Published on

0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
14,664
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
8
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. LOOPING STATEMENTINVB.NET
    1
    Department of CE/IT
  • 2. Looping Statement
    Loop statements are used to execute a block of statements repeatedly. For example to execute a statement 100 times, it is not necessary to write the statement 100 times in the program. VB.NET supports 3 types of loop statements
    While
    Do
    for
    2
    Department of CE/IT
  • 3. While
    This loop executes a set of statements when a condition is true. The statement block is executed repeatedly until the condition becomes false.
    3
    Department of CE/IT
  • 4. Syntax
    While <condition>
    Statement
    End while
    4
    Department of CE/IT
  • 5. Example
    Dim n As Integer
    N=0
    While n<10
    MsgBox(“Welcome to Ustudy.in”)
    N=n+1
    End While
    This program displays the word “Welcome to Ustudy.in “ 10 times.
    5
    Department of CE/IT
  • 6. Do Loop While
    The Do loop can be used to execute a fixed block of statements indefinite number of times. The Do loop keeps executing it's statements while or until the condition is true.
    Two keywords, while and until can be used with the do loop. The Do loop also supports an Exit Do statement which makes the loop to exit at any moment.
    6
    Department of CE/IT
  • 7. Syntax 1
    Example:
    Dim n As Integer
    n=10
    Do While (n<5)
    n=n+10
    Loop
    MsgBox(n)
    Output: 10
    Do While <condition>
    Statement block
    Loop
    7
    Department of CE/IT
  • 8. Syntax 2
    Example:
    Dim n As Integer
    n=10
    Do
    n=n+10
    Loop While (n<5)
    MsgBox(n)
    Output: 20
    Do
    Statement block
    Loop While <condition>
    8
    Department of CE/IT
  • 9. Do loop until
    This loop executes a block of statements repeatedly when the condition is false.
    9
    Department of CE/IT
  • 10. Syntax 1
    Example:
    Dim n As Integer
    Do until n>5
    n=n+10
    Loop
    MsgBox (n)
    Output: 10
    Do until <condition>
    Statement block
    Loop
    10
    Department of CE/IT
  • 11. Syntax 2
    Do
    Statement block
    Loop until <condition>
    Example:
    Dim n As Integer
    Do
    n=n+10
    Loop until n>5
    MsgBox (n)
    Output: 20
    11
    Department of CE/IT
  • 12. For loop
    The For loop is the most popular loop. For loops enable us to execute a series of expressions multiple numbers of times. The For loop in VB .NET needs a loop index which counts the number of loop iterations as the loop executes.
    12
    Department of CE/IT
  • 13. Syntax
    For index=start to end[Step step][statements][Exit For][statements]Next[index]
    13
    Department of CE/IT
  • 14. Example
    For i=1 to 10
    MsgBox (“Work hard God will stand by you”)
    Next
    The program display the string at 10 times
    14
    Department of CE/IT
  • 15. The End.
    … THANK U …
    15
    Department of CE/IT

×