01020300.xhp (d33d0967) 01020300.xhp (38deccd0)
1<?xml version="1.0" encoding="UTF-8"?>
2
1<?xml version="1.0" encoding="UTF-8"?>
2
3
4
5<!--***********************************************************
3<!--***********************************************************
6 *
4 *
7 * Licensed to the Apache Software Foundation (ASF) under one
8 * or more contributor license agreements. See the NOTICE file
9 * distributed with this work for additional information
10 * regarding copyright ownership. The ASF licenses this file
11 * to you under the Apache License, Version 2.0 (the
12 * "License"); you may not use this file except in compliance
13 * with the License. You may obtain a copy of the License at
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
14 *
12 *
15 * http://www.apache.org/licenses/LICENSE-2.0
13 * http://www.apache.org/licenses/LICENSE-2.0
16 *
14 *
17 * Unless required by applicable law or agreed to in writing,
18 * software distributed under the License is distributed on an
19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 * KIND, either express or implied. See the License for the
21 * specific language governing permissions and limitations
22 * under the License.
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
23 *
21 *
24 ***********************************************************-->
25
22 ***********************************************************-->
23
26
27
28
29 <helpdocument version="1.0">
24<helpdocument version="1.0">
30<meta>
31<topic id="textsbasicshared01020300xml" indexer="include" status="PUBLISH">
32<title id="tit" xml-lang="en-US">Using Procedures and Functions</title>
33<filename>/text/sbasic/shared/01020300.xhp</filename>
34</topic>
35</meta>
36<body>
37<section id="prozedur">

--- 9 unchanged lines hidden (view full) ---

47<bookmark_value>PRIVATE variables</bookmark_value>
48<bookmark_value>functions;return value type</bookmark_value>
49<bookmark_value>return value type of functions</bookmark_value>
50</bookmark>
51<paragraph role="heading" id="hd_id3149456" xml-lang="en-US" level="1" l10n="U" oldref="1"><link href="text/sbasic/shared/01020300.xhp">Using Procedures and Functions</link></paragraph>
52<paragraph role="paragraph" id="par_id3150767" xml-lang="en-US" l10n="U" oldref="2">The following describes the basic use of procedures and functions in $[officename] Basic.</paragraph>
53</section>
54<paragraph role="note" id="par_id3151215" xml-lang="en-US" l10n="U" oldref="56">When you create a new module, $[officename] Basic automatically inserts a SUB called "Main". This default name has nothing to do with the order or the starting point of a $[officename] Basic project. You can also safely rename this SUB.</paragraph>
25<meta>
26<topic id="textsbasicshared01020300xml" indexer="include" status="PUBLISH">
27<title id="tit" xml-lang="en-US">Using Procedures and Functions</title>
28<filename>/text/sbasic/shared/01020300.xhp</filename>
29</topic>
30</meta>
31<body>
32<section id="prozedur">

--- 9 unchanged lines hidden (view full) ---

42<bookmark_value>PRIVATE variables</bookmark_value>
43<bookmark_value>functions;return value type</bookmark_value>
44<bookmark_value>return value type of functions</bookmark_value>
45</bookmark>
46<paragraph role="heading" id="hd_id3149456" xml-lang="en-US" level="1" l10n="U" oldref="1"><link href="text/sbasic/shared/01020300.xhp">Using Procedures and Functions</link></paragraph>
47<paragraph role="paragraph" id="par_id3150767" xml-lang="en-US" l10n="U" oldref="2">The following describes the basic use of procedures and functions in $[officename] Basic.</paragraph>
48</section>
49<paragraph role="note" id="par_id3151215" xml-lang="en-US" l10n="U" oldref="56">When you create a new module, $[officename] Basic automatically inserts a SUB called "Main". This default name has nothing to do with the order or the starting point of a $[officename] Basic project. You can also safely rename this SUB.</paragraph>
55
56<paragraph role="note" id="par_id314756320" xml-lang="en-US" l10n="NEW">Some restrictions apply for the names of your public variables, subs, and functions. You must not use the same name as one of the modules of the same library.</paragraph>
50<paragraph role="note" id="par_id314756320" xml-lang="en-US" l10n="NEW">Some restrictions apply for the names of your public variables, subs, and functions. You must not use the same name as one of the modules of the same library.</paragraph>
57
58<paragraph role="paragraph" id="par_id3154124" xml-lang="en-US" l10n="U" oldref="3">Procedures (SUBS) and functions (FUNCTIONS) help you maintaining a structured overview by separating a program into logical pieces.</paragraph>
59<paragraph role="paragraph" id="par_id3153193" xml-lang="en-US" l10n="CHG" oldref="4">One benefit of procedures and functions is that, once you have developed a program code containing task components, you can use this code in another project.</paragraph>
60<paragraph role="heading" id="hd_id3153770" xml-lang="en-US" level="2" l10n="U" oldref="26">Passing Variables to Procedures (SUB) and Functions (FUNCTION)</paragraph>
61<paragraph role="paragraph" id="par_id3155414" xml-lang="en-US" l10n="U" oldref="27">Variables can be passed to both procedures and functions. The SUB or FUNCTION must be declared to expect parameters:</paragraph>
62<paragraph role="code" id="par_id3163710" xml-lang="en-US" l10n="U" oldref="28">SUB SubName(<emph>Parameter1 As Type, Parameter2 As Type,...</emph>)</paragraph>
63<paragraph role="code" id="par_id3151114" xml-lang="en-US" l10n="U" oldref="29">Program code</paragraph>
64<paragraph role="code" id="par_id3146975" xml-lang="en-US" l10n="U" oldref="30">END SUB</paragraph>
65<paragraph role="paragraph" id="par_id3152577" xml-lang="en-US" l10n="U" oldref="31">The SUB is called using the following syntax:</paragraph>

--- 57 unchanged lines hidden ---
51<paragraph role="paragraph" id="par_id3154124" xml-lang="en-US" l10n="U" oldref="3">Procedures (SUBS) and functions (FUNCTIONS) help you maintaining a structured overview by separating a program into logical pieces.</paragraph>
52<paragraph role="paragraph" id="par_id3153193" xml-lang="en-US" l10n="CHG" oldref="4">One benefit of procedures and functions is that, once you have developed a program code containing task components, you can use this code in another project.</paragraph>
53<paragraph role="heading" id="hd_id3153770" xml-lang="en-US" level="2" l10n="U" oldref="26">Passing Variables to Procedures (SUB) and Functions (FUNCTION)</paragraph>
54<paragraph role="paragraph" id="par_id3155414" xml-lang="en-US" l10n="U" oldref="27">Variables can be passed to both procedures and functions. The SUB or FUNCTION must be declared to expect parameters:</paragraph>
55<paragraph role="code" id="par_id3163710" xml-lang="en-US" l10n="U" oldref="28">SUB SubName(<emph>Parameter1 As Type, Parameter2 As Type,...</emph>)</paragraph>
56<paragraph role="code" id="par_id3151114" xml-lang="en-US" l10n="U" oldref="29">Program code</paragraph>
57<paragraph role="code" id="par_id3146975" xml-lang="en-US" l10n="U" oldref="30">END SUB</paragraph>
58<paragraph role="paragraph" id="par_id3152577" xml-lang="en-US" l10n="U" oldref="31">The SUB is called using the following syntax:</paragraph>

--- 57 unchanged lines hidden ---