11
Software Development using .NET VB.NET (Loop Structure) Presented By: Name : Abhishek Pachisia Course : B.Tech- IT(Sem V) Roll No. : 090102801 1 Made By: Abhishek Pachisia

Vb.net (loop structure)

Embed Size (px)

DESCRIPTION

Subject: .NET

Citation preview

Page 1: Vb.net (loop structure)

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

Page 2: Vb.net (loop structure)

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

Page 3: Vb.net (loop structure)

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

Page 4: Vb.net (loop structure)

Made By: Abhishek Pachisia 4

Types of Looping:

There are mainly 3 types of loop:

For Loop

While Loop

Do Loop

Page 5: Vb.net (loop structure)

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]

Page 6: Vb.net (loop structure)

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

Page 7: Vb.net (loop structure)

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

Page 8: Vb.net (loop structure)

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

Page 9: Vb.net (loop structure)

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

Page 10: Vb.net (loop structure)

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

Page 11: Vb.net (loop structure)

Made By: Abhishek Pachisia 11

THANKYOU