summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/fragments.xhp
blob: 9da8abd5159985cf4bfa27ba033bb9d1231834ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?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/.
   *
  -->
  <meta>
    <topic id="org.LibreOffice.sBasic.fragments.en" indexer="include" status="PUBLISH">
      <title id="tit" xml-lang="en-US">Basic syntax diagrams fragments</title>
      <filename>/text/sbasic/shared/fragments.xhp</filename>
    </topic>
  </meta>
  <body>
    <section id="fragments">
      <h1 id="hd_id541587044867073"><variable id="fragmentsh1"><link href="text/sbasic/shared/fragments.xhp" name="Syntax fragments">Syntax fragments</link></variable></h1>
      <paragraph role="paragraph" id="par_id881587044839050">%PRODUCTNAME Basic syntax fragments.</paragraph>
    </section>

<section id="argument">
  <h4 id="hd_id431587045941514"><variable id="argumenth2"><link href="text/sbasic/shared/fragments.xhp" name="arguments in Function, Sub and Property statements"></link>argument fragment</variable></h4>
    <paragraph role="paragraph" id="par_id491585753339474"><image src="media/helpimg/sbasic/argument_fragment.svg" id="img_id4156296484514"><alt xml-lang="en-US" id="alt_id15152796484514">argument fragment</alt></image></paragraph>
    <bascode>
      <paragraph role="bascode" id="par_id3151084" localize="false">{[Optional [ByRef|ByVal]]|ParamArray} argument {{As typename|char}[ = expression]|[()]As Variant}</paragraph>
    </bascode>
  <h4 id="hd_id811587303969210">Parameters</h4>
    <paragraph role="paragraph" id="par_id481586090298901"><literal>Optional</literal>: The argument is not mandatory.</paragraph>
    <paragraph role="paragraph" id="par_id331586090532804"><literal>ByRef</literal>: The argument is passed by reference. <literal>ByRef</literal> is the default.</paragraph>
    <paragraph role="paragraph" id="par_id331586090432804"><literal>ByVal</literal>: The argument is passed by value. Its value can be modified by the called routine.</paragraph>
    <paragraph role="paragraph" id="par_id651587044335713"><emph>char:</emph> Type declaration character.</paragraph>
    <paragraph role="paragraph" id="par_id651587044336713"><emph>typename</emph>: Primitive data type name. Library or module defined types can also be specified.</paragraph>
    <paragraph role="paragraph" id="par_id11587045141290"><emph>= expression</emph>: Specify a default value for the argument, matching its declared type. <literal>Optional</literal>  is necessary for each argument specifying a default value.</paragraph>
    <paragraph role="paragraph" id="par_id331586091432804"><literal>ParamArray</literal>: Use <literal>ParamArray</literal> when the number of parameters is undetermined. A typical scenario is that of a Calc user-defined function. Using <literal>ParamArray</literal> should be limited to the last argument of a routine.</paragraph>
    <tip id="par_id851587050837107">Using<literal>ParamArray</literal> or <emph>= expression</emph> require <link href="text/sbasic/shared/compatible.xhp" name ="Option Compatible">Option Compatible</link> to be placed before the executable program code in a module.</tip>
  <warning id="par_id391587571321063">When using <link href="text/sbasic/shared/vbasupport.xhp" name ="Option VBASupport">Option VBASupport 1</link>, <literal>Optional</literal> arguments with no default value (<emph>= expression</emph>) are initialized according to their data type, except if <literal>Variant</literal>.</warning>
</section>

<section id="array">
  <h4 id="hd_id231587046013456"><variable id="arrayh4"><link href="text/sbasic/shared/fragments.xhp" name="array syntax fragment">array fragment</link></variable></h4>
    <paragraph role="paragraph" id="par_id491586753339473"><image src="media/helpimg/sbasic/array_fragment.svg" id="img_id4156296484514"><alt xml-lang="en-US" id="alt_id15152796484514">array fragment</alt></image></paragraph>
    <bascode>
      <paragraph role="bascode" id="par_id3150983" localize="false">( [[start To] end], .. )</paragraph>
    </bascode>
    <h4 id="hd_id731587304120258">Parameters</h4>
    <paragraph role="paragraph" id="par_id951587051619162"><emph>start:</emph> Lower bound of a dimension.</paragraph>
    <paragraph role="paragraph" id="par_id951587052619162"><emph>end:</emph> Upper bound of a dimension.</paragraph>
  <paragraph role="paragraph" id="par_id961587051702571">Multiple dimensions for an array are denoted using comma (<emph>,</emph>) sign.</paragraph>
</section>

<section id="typename">
  <h4 id="hd_id231587046013458"><variable id="typenameh4">typename fragment</variable></h4>
    <paragraph role="paragraph" id="par_id501586753339474"><image src="media/helpimg/sbasic/typename_fragment.svg" id="img_id4157296484514"><alt xml-lang="en-US" id="alt_id15152796484515">primitive data types fragment</alt></image></paragraph>
    <bascode>
      <paragraph role="bascode" id="par_id3150985" localize="false">{Boolean|Byte|Currency|Date|Double|Integer|Long|Object|Single|String|Variant}</paragraph>
    </bascode>
</section>

<section id="char">
  <h4 id="hd_id231587046013459"><variable id="charh4">char fragment</variable></h4>
    <paragraph role="paragraph" id="par_id511586753339474"><image src="media/helpimg/sbasic/char_fragment.svg" id="img_id4157296484514"><alt xml-lang="en-US" id="alt_id15152796484516">type declaration characters</alt></image></paragraph>
    <bascode>
      <paragraph role="bascode" id="par_id3150986" localize="false">{ % | &amp; | ! | # | $ | @ }</paragraph>
    </bascode>
</section>

</body>
</helpdocument>