summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/03103500.xhp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /helpcontent2/source/text/sbasic/shared/03103500.xhp
parentInitial commit. (diff)
downloadlibreoffice-upstream/4%7.4.7.tar.xz
libreoffice-upstream/4%7.4.7.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/03103500.xhp')
-rw-r--r--helpcontent2/source/text/sbasic/shared/03103500.xhp71
1 files changed, 71 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03103500.xhp b/helpcontent2/source/text/sbasic/shared/03103500.xhp
new file mode 100644
index 000000000..52a0261bb
--- /dev/null
+++ b/helpcontent2/source/text/sbasic/shared/03103500.xhp
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+<!--
+ * 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 .
+-->
+
+<meta>
+ <topic id="textsbasicshared03103500xml" indexer="include" status="PUBLISH">
+ <title id="tit" xml-lang="en-US">Static Statement</title>
+ <filename>/text/sbasic/shared/03103500.xhp</filename>
+ </topic>
+</meta>
+
+<body>
+
+
+<section id="static">
+<bookmark xml-lang="en-US" branch="index" id="bm_id3149798">
+ <bookmark_value>Static statement</bookmark_value>
+</bookmark>
+
+
+<paragraph id="hd_id3149798" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03103500.xhp" name="Static Statement">Static Statement</link></paragraph>
+<paragraph id="par_id3153311" role="paragraph" xml-lang="en-US">Declares a variable or an array at the procedure level within a subroutine or a function, so that the values of the variable or the array are retained after exiting the subroutine or function. Dim statement conventions are also valid.</paragraph>
+</section>
+<paragraph id="par_id3147264" role="warning" xml-lang="en-US">The <emph>Static statement</emph> cannot be used to define variable arrays. Arrays must be specified according to a fixed size.</paragraph>
+
+<paragraph id="hd_id3149657" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
+<bascode>
+<paragraph id="par_id3150400" role="bascode" xml-lang="en-US">Static VarName[(start To end)] [As VarType], VarName2[(start To end)] [As VarType], ...</paragraph>
+</bascode>
+
+<paragraph id="hd_id3148452" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
+<bascode>
+<paragraph id="par_idm1340791536" role="bascode" localize="false" xml-lang="en-US">Sub ExampleStatic</paragraph>
+<paragraph id="par_idm1340790304" role="bascode" localize="false" xml-lang="en-US">Dim iCount As Integer, iResult As Integer</paragraph>
+<paragraph id="par_idm1340789040" role="bascode" localize="false" xml-lang="en-US"> For iCount = 0 To 2</paragraph>
+<paragraph id="par_idm1340787808" role="bascode" localize="false" xml-lang="en-US"> iResult = InitVar()</paragraph>
+<paragraph id="par_idm1340786560" role="bascode" localize="false" xml-lang="en-US"> Next iCount</paragraph>
+<paragraph id="par_id3150870" role="bascode" xml-lang="en-US"> MsgBox iResult,0,"The answer is"</paragraph>
+<paragraph id="par_idm1340783600" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
+<paragraph id="par_idm1340782368" role="bascode" localize="false" xml-lang="en-US"> </paragraph>
+<paragraph id="par_id3151115" role="bascode" xml-lang="en-US">' Function for initialization of the static variable</paragraph>
+<paragraph id="par_idm1340779328" role="bascode" localize="false" xml-lang="en-US">Function InitVar() As Integer</paragraph>
+<paragraph id="par_idm1340778080" role="bascode" localize="false" xml-lang="en-US"> Static iInit As Integer</paragraph>
+<paragraph id="par_id1057161" role="bascode" xml-lang="en-US"> Const iMinimum As Integer = 40 ' minimum return value of this function</paragraph>
+<paragraph id="par_id580462" role="bascode" xml-lang="en-US"> If iInit = 0 Then ' check if initialized</paragraph>
+<paragraph id="par_idm1340950464" role="bascode" localize="false" xml-lang="en-US"> iInit = iMinimum</paragraph>
+<paragraph id="par_idm1340949216" role="bascode" localize="false" xml-lang="en-US"> Else</paragraph>
+<paragraph id="par_idm1340947984" role="bascode" localize="false" xml-lang="en-US"> iInit = iInit + 1</paragraph>
+<paragraph id="par_idm1340946736" role="bascode" localize="false" xml-lang="en-US"> End If</paragraph>
+<paragraph id="par_idm1340945504" role="bascode" localize="false" xml-lang="en-US"> InitVar = iInit</paragraph>
+<paragraph id="par_idm1340944272" role="bascode" localize="false" xml-lang="en-US">End Function</paragraph>
+</bascode>
+</body>
+
+</helpdocument> \ No newline at end of file