While...Wend Statement

ํ”„๋กœ๊ทธ๋žจ์€ While ๋ฌธ์„ ๋งŒ๋‚  ๊ฒฝ์šฐ ์กฐ๊ฑด์„ ํ…Œ์ŠคํŠธํ•ฉ๋‹ˆ๋‹ค. ์กฐ๊ฑด์ด False์ผ ๊ฒฝ์šฐ Wend ๋ฌธ์˜ ๋ฐ”๋กœ ๋‹ค์Œ๋ถ€ํ„ฐ ํ”„๋กœ๊ทธ๋žจ ์‹คํ–‰์ด ๊ณ„์†๋ฉ๋‹ˆ๋‹ค. ์กฐ๊ฑด์ด True์ผ ๊ฒฝ์šฐ Wend๊ฐ€ ์žˆ๋Š” ๊ณณ๊นŒ์ง€ ๋ฃจํ”„๊ฐ€ ์‹คํ–‰๋œ ๋‹ค์Œ ๋‹ค์‹œ While ๋ฌธ์œผ๋กœ ๋˜๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค. ์กฐ๊ฑด์ด ์—ฌ์ „ํžˆ True์ผ ๊ฒฝ์šฐ ๋ฃจํ”„๊ฐ€ ๋‹ค์‹œ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

Do...Loop์™€ ๋‹ฌ๋ฆฌ While...Wend ๋ฃจํ”„๋Š” Exit๋กœ ์ทจ์†Œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ While...Wend ๋ฃจํ”„๋ฅผ GoTo๋กœ ์ข…๋ฃŒํ•  ๊ฒฝ์šฐ ๋Ÿฐํƒ€์ž„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ฃผ์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์œ ์—ฐ์„ฑ์ด ๋” ๋›ฐ์–ด๋‚˜๋‹ค๋Š” ์ ์—์„œ Do...Loop๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ:

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