IBM Lotus Symphony


While...Wend 语句 [运行时]

当遇到 While 语句时,程序将对条件进行测试。如果条件为 False,请直接执行 Wend 语句之后的程序。如果条件为 True,将一直执行循环,直到程序发现 Wend 语句,此时程序将跳回到 While 语句。如果条件仍为 True,请再次执行循环。

Do...Loop 语句不同, 您不能用 Exit 取消 While...Wend 循环。请勿使用 GoTo 语句退出 While...Wend 循环,否则将导致运行时错误。

Do...Loop 语句比 While...Wend 语句更加灵活。

语法:

While Condition [Statement] Wend

示例:

Sub ExampleWhileWend

Dim stext As String

Dim iRun As Integer

sText ="This is a short text"

iRun = 1

while iRun < Len(sText)

if Mid(sText,iRun,1 )<> " " then Mid( sText ,iRun, 1, Chr( 1 + Asc( Mid(sText,iRun,1 )) )

iRun = iRun + 1

Wend

MsgBox sText,0,"Text encoded"

end sub


产品反馈 | 其他文档 | 商标