×

VB.Net基本教程

VB.Net 环境设置VB.Net 程序结构VB.Net 基本语法VB.Net 数据类型VB.Net 变量VB.Net 常数和枚举VB.Net 修饰符VB.Net 声明VB.Net 指令VB.Net 运算符VB.Net 决策VB.Net 循环VB.Net 字符串VB.Net 日期和时间VB.Net 数组VB.Net 集合VB.Net 函数VB.Net Sub过程(子程序)VB.Net 类与对象VB.Net 异常处理VB.Net 文件处理VB.Net 基本控制VB.Net 对话框VB.Net 高级表单VB.Net 事件处理

VB.Net 高级教程

VB.Net 正则表达式VB.Net 数据库访问VB.Net Excel工作表VB.Net 发送邮件VB.Net XML处理VB.Net Web编程

VB.Net 有用的资源

VB.Net 有用资源

VB.Net While... End While循环


VB.Net  循环VB.Net 循环


只要给定条件为True,While... End While就执行一系列语句。

这个循环结构的语法是:

While condition
    [ statements ]
    [ Continue While ]
    [ statements ]
    [ Exit While ]
    [ statements ]
End While

这里,语句可以是单个语句或语句块。 条件可以是任何表达式,true是逻辑true。 当条件为真时,循环迭代。

当条件变为假时,程序控制传递到紧随循环之后的行。

流程图:


While... End While流程图

这里,While循环的关键点是循环可能永远不会运行。 当条件被测试并且结果为false时,循环体将被跳过,vbnet-while循环之后的第一条语句将被执行。

示例:

Module loops
   Sub Main()
      Dim a As Integer = 10
      ' vbnet-while loop execution '
      While a < 20
          Console.WriteLine("value of a: {0}", a)
          a = a + 1
      End While
      Console.ReadLine()
   End Sub
End Module

当上述代码被编译和执行时,它产生以下结果:
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



VB.Net  循环VB.Net 循环


分类导航

关注微信下载离线手册

bootwiki移动版 bootwiki
(群号:472910771)