diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /helpcontent2/source/text/sbasic/shared/03090203.xhp | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03090203.xhp')
-rw-r--r-- | helpcontent2/source/text/sbasic/shared/03090203.xhp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03090203.xhp b/helpcontent2/source/text/sbasic/shared/03090203.xhp new file mode 100644 index 000000000..dad29dca3 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03090203.xhp @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + --> + +<helpdocument version="1.0"> +<meta> +<topic id="textsbasicshared03090203xml" indexer="include" status="PUBLISH"> +<title xml-lang="en-US" id="tit">While...Wend Statement</title> +<filename>/text/sbasic/shared/03090203.xhp</filename> +</topic> +<history> +<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created> +</history> +</meta> +<body> + + <section id="whilewend"> + <bookmark xml-lang="en-US" branch="index" id="bm_id3150400"> + <bookmark_value>While;While...Wend loop</bookmark_value> + <bookmark_value>While;While Wend loop</bookmark_value> + </bookmark> + <paragraph id="hd_id3150400" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03090203.xhp" name="While...Wend Statement">While...Wend Statement</link></paragraph> + <paragraph xml-lang="en-US" role="paragraph" id="par_id3151211">When a program encounters a <literal>While</literal> statement, it tests the condition. If the condition is <literal>False</literal>, the program continues directly following the <literal>Wend</literal> statement. If the condition is <literal>True</literal>, the loop is executed until the program finds <literal>Wend</literal> and then jumps back to the <emph>While</emph> statement. If the condition is still <literal>True</literal>, the loop is executed again.</paragraph> + </section> + <paragraph xml-lang="en-US" id="par_id3151041" role="paragraph">Unlike the <link href="text/sbasic/shared/03090201.xhp" name="Do...Loop">Do...Loop</link> statement, you cannot cancel a <emph>While...Wend</emph> loop with <link href="text/sbasic/shared/03090412.xhp" name="Exit">Exit</link>. Never exit a <literal>While...Wend</literal> loop with <link href="text/sbasic/shared/03090302.xhp" name="GoTo">GoTo</link>, since this can cause a run-time error.</paragraph> + <paragraph role="paragraph" id="par_id3145172" xml-lang="en-US">A <literal>Do...Loop</literal> is more flexible than a <literal>While...Wend.</literal></paragraph> + + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <paragraph role="image" id="par_id831588865616326"> + <image src="media/helpimg/sbasic/While_statement.svg" id="img_id651588865616326"><alt id="alt_id281588865616326">While syntax</alt></image> + </paragraph> +<bascode> + <paragraph role="bascode" id="par_id3147288" localize="false">While Condition [statements] Wend</paragraph> +</bascode> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> +<bascode> + <paragraph role="bascode" id="par_id3159153" localize="false">Sub ExampleWhileWend</paragraph> + <paragraph role="bascode" id="par_id3151114" localize="false"> Dim stext As String</paragraph> + <paragraph role="bascode" id="par_id3153143" localize="false"> Dim iRun As Integer</paragraph> + <paragraph role="bascode" id="par_id3155306" xml-lang="en-US"> sText ="This is a short text"</paragraph> + <paragraph role="bascode" id="par_id3154011" localize="false"> iRun = 1</paragraph> + <paragraph role="bascode" id="par_id3147215" localize="false"> While iRun < Len(sText)</paragraph> + <paragraph role="bascode" id="par_id3147427" localize="false"> If Mid(sText,iRun,1 )<> " " Then Mid( sText ,iRun, 1) = Chr( 1 + Asc( Mid(sText,iRun,1 )) )</paragraph> + <paragraph role="bascode" id="par_id3149665" localize="false"> iRun = iRun + 1</paragraph> + <paragraph role="bascode" id="par_id3152939" localize="false"> Wend</paragraph> + <paragraph role="bascode" id="par_id3153189" xml-lang="en-US"> MsgBox sText,0,"Text encoded"</paragraph> + <paragraph role="bascode" localize="false" id="par_id3145251">End Sub</paragraph> +</bascode> + + <section id="relatedtopics"> + <paragraph role="paragraph" id="par_id161588865796615"><link href="text/sbasic/shared/03090201.xhp" name="Do...Loop statement">Do...Until</link> or <link href="text/sbasic/shared/03090201.xhp" name="Do...While statement">Do...While</link> statement</paragraph> + <paragraph role="paragraph" id="par_id281588865818334"><link href="text/sbasic/shared/03090412.xhp" name="Exit statement">Exit</link> statement</paragraph> + </section> + + </body> +</helpdocument> |