Upload
abhishek-pachisia
View
3.486
Download
2
Embed Size (px)
DESCRIPTION
Subject: .NET
Citation preview
Made By: Abhishek Pachisia 1
Software Development using .NET
VB.NET (Loop Structure)Presented By:
Name : Abhishek PachisiaCourse : B.Tech-IT(Sem V)Roll No. : 090102801
Made By: Abhishek Pachisia 2
What is VB.NET?
•It is simply Visual Basic for .NET platform developed by Microsoft.
•It has more components and control than Visual Basic
VB.NET
Made By: Abhishek Pachisia 3
Visual Basic loop structures allow to run one or more lines of code repetitively
Statements in a loop structure can be repeated
Until a condition is TrueUntil a condition is FalseA specified number of times, or Once for each element in a collection.
Loop Structure
Made By: Abhishek Pachisia 4
Types of Looping:
There are mainly 3 types of loop:
For Loop
While Loop
Do Loop
Made By: Abhishek Pachisia 5
FOR Loop• The For loop is the most popular loop.
•For loops enable us to execute a series of expressions multiple numbers of times.
•Syntax:
For index=start to end[Step step][statements][Exit For][statements]Next[index]
Made By: Abhishek Pachisia 6
Example:
Module Module1
Sub Main()Dim d As IntegerFor d = 0 To 2System.Console.WriteLine("In the For
Loop")Next dEnd Sub
End Module
Made By: Abhishek Pachisia 7
While Loop
•While loop keeps executing until the condition against which it tests remain true.
•Syntax:
While condition[statements]End While
Made By: Abhishek Pachisia 8
Example:
Module Module1
Sub Main()Dim d, e As Integerd = 0e = 6While e > 4e -= 1d += 1End WhileSystem.Console.WriteLine("The Loop ran " & e
& "times")End Sub
End Module
Made By: Abhishek Pachisia 9
DO Loop•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.
•Syntax:
Do[{while | Until} condition][statements][Exit Do][statements]Loop
Made By: Abhishek Pachisia 10
Example:
Module Module1
Sub Main()Dim str As StringDo Until str = "Cool"System.Console.WriteLine("What to
do?")str = System.Console.ReadLine()LoopEnd Sub
End Module
Made By: Abhishek Pachisia 11
THANKYOU