Lotus Symphony 1.2


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


其他文件 | 商標