LibreOffice 7.5 Help
Repeats the statements between the Do and the Loop statement while the condition is True or until the condition becomes True.
Do {While | Until} condition = True
' Do While: The statement block is repeated as long as the condition is true
' Do Until: The statement block is repeated as long as the condition is false
statements
[Exit Do]
statements
Loop
Do
statements
[Exit Do]
statements
' Loop While: The statement block repeats as long as the condition is true
' Loop Until: The statement block repeats until the condition is true
Loop {While | Until} condition = True
The Do...Loop statement executes a loop as long as, or until, a certain condition is True. The condition for exiting the loop must be entered following either the Do or the Loop statement. The above examples are valid combinations.
condition: A comparison, numeric or Basic expression, that evaluates to either True or False.
statements: Statements that you want to repeat while or until a condition is True.
'рдЧрд░реНрдиреБрд╣реЛрд╕реН' рдмрд╛рдЯ рдмрд╛рд╣рд┐рд░рд┐рдиреБрд╣реЛрд╕реН рдХрдердирд▓реЗ рдЕрдкреНрд░рд╛рд╕рдпреЛрдЧрд┐рдХ рдЕрдиреНрддреНрдпрд▓рд╛рдИ рд▓реВрдк рдЧрд░реНрджрдЫ ред рддрдкрд╛рдИрдБ рдпреЛ рдХрдердирд▓рд╛рдИ рдЧрд░реНрдиреБрд╣реЛрд╕реН...рд▓реВрдкрдХрдердирдХреЛ рдЬреБрдирд╕реБрдХреИ рд╕реНрдерд╛рдирдорд╛ рдердкреНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ ред рддрдкрд╛рдИрдБ рдпрджрд┐...рддреНрдпрд╕рдкрдЫрд┐рдмрдиреМрдЯрдХреЛ рдкреНрд░рдпреЛрдЧ рдЧрд░реЗрд░ рдЕрд╡рд╕реНрдерд┐рдд рдЕрд╡рд╕реНрдерд╛ рдкрд░рд┐рднрд╛рд╖рд┐рдд рдЧрд░реНрди рд╕рдХреНрдиреБрд╣реБрдиреНрдЫ рдЬреБрди рддрд▓рджрд┐рдПрдХреЛ рдЫ:
Do...
statements
If condition = True Then Exit Do
statements
Loop...
Sub ExampleDoLoop
Dim sFile As String
Dim sPath As String
sPath = "c:\"
sFile = Dir$( sPath ,22)
If sFile <> "" Then
Do
MsgBox sFile
sFile = Dir$
Loop Until sFile = ""
End If
End Sub