From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03090201.xhp | 102 +++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03090201.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03090201.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03090201.xhp b/helpcontent2/source/text/sbasic/shared/03090201.xhp new file mode 100644 index 000000000..696ffeecd --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03090201.xhp @@ -0,0 +1,102 @@ + + + + + + + Do...Loop Statement + /text/sbasic/shared/03090201.xhp + + + + + +
+ + Do...Loop statement + While; Do loop + Until + loops + + + +Do...Loop Statement + Repeats the statements between the Do and the Loop statement while the condition is True or until the condition becomes True. +
+ + +Do statement + + 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...Loop statement + + 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. + +Use the Exit Do statement to unconditionally end the loop. You can add this statement anywhere in a Do...Loop statement. You can also define an exit condition using the If...Then structure as follows: + + 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 + + +
+ For, Select Case or While statements + Iif or Switch functions +
+ + +
-- cgit v1.2.3