Vb.net (loop structure)

6,518 views

Published on

Subject: .NET

Published in: Education, Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,518
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
189
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Vb.net (loop structure)

  1. 1. Presented By: Name : Abhishek Pachisia Course : B.Tech-IT(Sem V) Roll No. : 090102801Made By: Abhishek Pachisia 1
  2. 2. What is VB.NET?•It is simply Visual Basic for .NET platform developedby Microsoft.•It has more components and control than Visual Basic Made By: Abhishek Pachisia 2
  3. 3. Visual Basic loop structures allow to run one ormore lines of code repetitivelyStatements in a loop structure can be repeated Until a condition is True Until a condition is False A specified number of times, or Once for each element in a collection. Made By: Abhishek Pachisia 3
  4. 4. Types of Looping:There are mainly 3 types of loop:For LoopWhile LoopDo Loop Made By: Abhishek Pachisia 4
  5. 5. • The For loop is the most popular loop.•For loops enable us to execute a series of expressionsmultiple numbers of times.•Syntax: For index=start to end[Step step] [statements] [Exit For] [statements] Next[index] Made By: Abhishek Pachisia 5
  6. 6. Example: Module Module1 Sub Main() Dim d As Integer For d = 0 To 2 System.Console.WriteLine("In the For Loop") Next d End Sub End Module Made By: Abhishek Pachisia 6
  7. 7. •While loop keeps executing until thecondition against which it tests remain true.•Syntax: While condition [statements] End While Made By: Abhishek Pachisia 7
  8. 8. Example: Module Module1 Sub Main() Dim d, e As Integer d=0 e=6 While e > 4 e -= 1 d += 1 End While System.Console.WriteLine("The Loop ran " & e &"times") End Sub End Module By: Abhishek Pachisia Made 8
  9. 9. •The Do loop keeps executing its statements while or until thecondition is true.•Two keywords, while and until can be used with the do loop.•The Do loop also supports an Exit Do statement which makesthe loop to exit at any moment.•Syntax: Do[{while | Until} condition] [statements] [Exit Do] [statements] Loop Made By: Abhishek Pachisia 9
  10. 10. Example: Module Module1 Sub Main() Dim str As String Do Until str = "Cool" System.Console.WriteLine("What to do?") str = System.Console.ReadLine() Loop End Sub End Module Made By: Abhishek Pachisia 10
  11. 11. Made By: Abhishek Pachisia 11

×