vbscripting/loops.vbs
2022-10-11 11:29:27 +04:00

45 lines
810 B
Text

Rem Öèêëû
Rem Ïðîñòîé áðóòôîðñ
Option Explicit
Dim num, i
Dim res1, res2, res3, res4 'Íåíóæíûå ïåðåìåííûå äëÿ msgbox
num = CInt(InputBox("Ââåäè öåëîå ÷èñëî", "Áðóòôîðñ"))
Rem Do-While-Loop
i = 0
Do While (i < num)
i = i + 1
loop
res1 = MsgBox("Âàøå ÷èñëî: " & i & ".", vbOK, "Do-While-Loop")
Rem Do-Until-Loop
i = 0
Do Until (i = num)
i = i + 1
loop
res2 = MsgBox("Âàøå ÷èñëî: " & i & ".", vbOK, "Do-Until-Loop")
Rem While-Wend
i = 0
While i < num
i = i + 1
Wend
res3 = MsgBox("Âàøå ÷èñëî: " & i & ".", vbOK, "While-Wend")
Rem For, ñ çàùèòîé îò ïåðåãðóçêè
i = 0
For i=0 To 3000
If i = num then Exit For End if
next
If Not i = num then
MsgBox "Ïåðåãðóçêà! (Èòåðàöèé áîëåå 3000)."
else
res4 = MsgBox("Âàøå ÷èñëî: " & i & ".", vbOK, "For ñ çàùèòîé")
End if