VB.Net - For...Next Loop - Tutorialspoint
Có thể bạn quan tâm
VB.Net - For...Next Loop Previous Quiz Next
It repeats a group of statements a specified number of times and a loop index counts the number of loop iterations as the loop executes.
The syntax for this loop construct is −
For counter [ As datatype ] = start To end [ Step step ] [ statements ] [ Continue For ] [ statements ] [ Exit For ] [ statements ] Next [ counter ]Flow Diagram
Example
Module loops Sub Main() Dim a As Byte ' for loop execution For a = 10 To 20 Console.WriteLine("value of a: {0}", a) Next Console.ReadLine() End Sub End ModuleWhen the above code is compiled and executed, it produces the following result −
value of a: 10 value of a: 11 value of a: 12 value of a: 13 value of a: 14 value of a: 15 value of a: 16 value of a: 17 value of a: 18 value of a: 19 value of a: 20If you want to use a step size of 2, for example, you need to display only even numbers, between 10 and 20 −
Module loops Sub Main() Dim a As Byte ' for loop execution For a = 10 To 20 Step 2 Console.WriteLine("value of a: {0}", a) Next Console.ReadLine() End Sub End ModuleWhen the above code is compiled and executed, it produces the following result −
value of a: 10 value of a: 12 value of a: 14 value of a: 16 value of a: 18 value of a: 20 vb.net_loops.htm Print Page Previous Next AdvertisementsTừ khóa » Visual Basic For Next
-
For...Next Statement - Visual Basic - Microsoft Docs
-
For Each...Next Statement - Visual Basic - Microsoft Docs
-
VB.NET For Next Loop - Javatpoint
-
Visual Basic For Next Statemen | The Coding Guys
-
VB.NET For Loop Examples (For Each) - Dot Net Perls
-
For Next Loop - VB.NET - RIP Tutorial
-
Visual Basic Tutorial - 26 - For Next Loop - YouTube
-
For Loop - For...Next Statement - VB.NET
-
Visual Basic (VB) For Loop - Tutlane
-
Looping In Visual Basic 2010
-
Visual Basic/Loops - Wikibooks, Open Books For An Open World
-
For...Next Statement
-
Visual Basic For Loops - Techotopia
-
For-Next Loop Visual Basic - Vba - Stack Overflow