循环语句允许我们多次执行一个语句或一组语句,以下是大多数编程语言中循环语句的一般形式:
VB.Net提供以下类型的循环来处理循环需求。 单击以下链接以检查其详细信息。
循环类型 | 描述 |
---|---|
It repeats the enclosed block of statements while a Boolean condition is True or until the condition becomes True. It could be terminated at any time with the Exit Do statement. 它重复包含的语句块内布尔条件为True或直到条件变为True。 它可以随时使用Exit Do语句终止。 |
|
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. 它重复指定次数的一组语句,循环索引计算循环执行时的循环迭代数。 |
|
It repeats a group of statements for each element in a collection. This loop is used for accessing and manipulating all elements in an array or a VB.Net collection. 它为集合中的每个元素重复一组语句。 这个循环用于访问和操作数组或VB.Net集合中的所有元素。 |
|
It executes a series of statements as long as a given condition is True. 只要给定条件为True,它就执行一系列语句。 |
|
It is not exactly a looping construct. It executes a series of statements that repeatedly refer to a single object or structure. 它不是一个循环结构。 它执行一系列重复引用单个对象或结构的语句。 |
|
You can use one or more loops inside any another While, For or Do loop. 您可以在任何其他While,For或Do循环中使用一个或多个循环。 |
控制语句 | 描述 |
---|---|
Terminates the loop or select case statement and transfers execution to the statement immediately following the loop or select case. 终止循环或选择大小写语句,并将执行转移到循环或选择大小之后的语句。 |
|
Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.导致循环跳过其本身的其余部分,并在重复之前立即重新测试其状态。 | |
Transfers control to the labeled statement. Though it is not advised to use GoTo statement in your program. 将控制转移到带标签的语句。 虽然不建议在程序中使用GoTo语句。 |