summaryrefslogtreecommitdiff
path: root/source/text/sbasic/shared/01020100.xhp
diff options
context:
space:
mode:
Diffstat (limited to 'source/text/sbasic/shared/01020100.xhp')
-rw-r--r--source/text/sbasic/shared/01020100.xhp124
1 files changed, 90 insertions, 34 deletions
diff --git a/source/text/sbasic/shared/01020100.xhp b/source/text/sbasic/shared/01020100.xhp
index 60fc9a17e7..c6cdd92fe5 100644
--- a/source/text/sbasic/shared/01020100.xhp
+++ b/source/text/sbasic/shared/01020100.xhp
@@ -59,7 +59,9 @@
<table id="tbl_id3154685">
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3163798" xml-lang="en-US" l10n="U" oldref="7">MyNumber=5</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">MyNumber=5</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3156441" xml-lang="en-US" l10n="U" oldref="126">Correct</paragraph>
@@ -67,7 +69,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3147317" xml-lang="en-US" l10n="U" oldref="8">MyNumber5=15</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">MyNumber5=15</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3149664" xml-lang="en-US" l10n="U" oldref="127">Correct</paragraph>
@@ -75,7 +79,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3145364" xml-lang="en-US" l10n="U" oldref="9">MyNumber_5=20</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">MyNumber_5=20</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3146119" xml-lang="en-US" l10n="U" oldref="128">Correct</paragraph>
@@ -83,7 +89,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3154729" xml-lang="en-US" l10n="U" oldref="10">My Number=20</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">My Number=20</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3153876" xml-lang="en-US" l10n="U" oldref="11">Not valid, variable with space must be enclosed in square brackets</paragraph>
@@ -91,7 +99,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3147126" xml-lang="en-US" l10n="U" oldref="14">[My Number]=12</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">[My Number]=12</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3154510" xml-lang="en-US" l10n="U" oldref="15">Correct</paragraph>
@@ -99,7 +109,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3153708" xml-lang="en-US" l10n="U" oldref="12">DéjàVu=25</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">DéjàVu=25</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3150330" xml-lang="en-US" l10n="U" oldref="129">Not valid, special characters are not allowed</paragraph>
@@ -107,7 +119,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3155443" xml-lang="en-US" l10n="U" oldref="13">5MyNumber=12</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">5MyNumber=12</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3154254" xml-lang="en-US" l10n="U" oldref="130">Not valid, variable may not begin with a number</paragraph>
@@ -115,7 +129,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3147345" xml-lang="en-US" l10n="U" oldref="16">Number,Mine=12</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Number,Mine=12</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3149256" xml-lang="en-US" l10n="U" oldref="131">Not valid, punctuation marks are not allowed</paragraph>
@@ -128,7 +144,9 @@
<table id="tbl_id3154658">
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3150090" xml-lang="en-US" l10n="U" oldref="19">DIM a$</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim a$</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3150982" xml-lang="en-US" l10n="U" oldref="132">Declares the variable "a" as a String</paragraph>
@@ -136,7 +154,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3149531" xml-lang="en-US" l10n="U" oldref="20">DIM a As String</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim a As String</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3150343" xml-lang="en-US" l10n="U" oldref="133">Declares the variable "a" as a String</paragraph>
@@ -144,7 +164,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3149036" xml-lang="en-US" l10n="U" oldref="21">DIM a$, b As Integer</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim a$, b As Integer</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3155507" xml-lang="en-US" l10n="U" oldref="22">Declares one variable as a String and one as an Integer</paragraph>
@@ -152,7 +174,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_idN10854" xml-lang="en-US" l10n="NEW">DIM c As Boolean</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim c As Boolean</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_idN10859" xml-lang="en-US" l10n="NEW">Declares c as a Boolean variable that can be TRUE or FALSE</paragraph>
@@ -163,7 +187,9 @@
<table id="tbl_id3155529">
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3152985" xml-lang="en-US" l10n="U" oldref="24">DIM a$</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim a$</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3154527" xml-lang="en-US" l10n="U" oldref="134">Declares "a" as a String</paragraph>
@@ -171,7 +197,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3148599" xml-lang="en-US" l10n="U" oldref="25">a="TestString"</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">a="TestString"</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3153064" xml-lang="en-US" l10n="U" oldref="135">Type-declaration missing: "a$="</paragraph>
@@ -181,7 +209,9 @@
<paragraph role="warning" id="par_id3144770" xml-lang="en-US" l10n="U" oldref="26">Once you have declared a variable as a certain type, you cannot declare the variable under the same name again as a different type!</paragraph>
<paragraph role="heading" id="hd_id3149331" xml-lang="en-US" level="3" l10n="U" oldref="27">Forcing Variable Declarations</paragraph>
<paragraph role="paragraph" id="par_id3149443" xml-lang="en-US" l10n="U" oldref="28">To force declaration of variables, use the following command:</paragraph>
-<paragraph role="code" id="par_id3152869" xml-lang="en-US" l10n="U" oldref="29">OPTION EXPLICIT</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Option Explicit</paragraph>
+</bascode>
<paragraph role="paragraph" id="par_id3155072" xml-lang="en-US" l10n="U" oldref="30">The <emph>Option Explicit</emph> statement has to be the first line in the module, before the first SUB. Generally, only arrays need to be declared explicitly. All other variables are declared according to the type-declaration character, or - if omitted - as the default type <emph>Single</emph>.</paragraph>
<paragraph role="heading" id="hd_id3154614" xml-lang="en-US" level="2" l10n="U" oldref="34">Variable Types</paragraph>
<paragraph role="paragraph" id="par_id3155383" xml-lang="en-US" l10n="U" oldref="35">$[officename] Basic supports four variable classes:</paragraph>
@@ -205,37 +235,53 @@
</list>
<paragraph role="heading" id="hd_id3153805" xml-lang="en-US" level="3" l10n="U" oldref="40">Integer Variables</paragraph>
<paragraph role="paragraph" id="par_id3146966" xml-lang="en-US" l10n="U" oldref="41">Integer variables range from -32768 to 32767. If you assign a floating-point value to an integer variable, the decimal places are rounded to the next integer. Integer variables are rapidly calculated in procedures and are suitable for counter variables in loops. An integer variable only requires two bytes of memory. "%" is the type-declaration character.</paragraph>
-<paragraph role="code" id="par_id3153810" xml-lang="en-US" l10n="U" oldref="43">Dim Variable%</paragraph>
-<paragraph role="code" id="par_id3153556" xml-lang="en-US" l10n="U" oldref="44">Dim Variable As Integer</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable%</paragraph>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Integer</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3147546" xml-lang="en-US" level="3" l10n="U" oldref="45">Long Integer Variables</paragraph>
<paragraph role="paragraph" id="par_id3151193" xml-lang="en-US" l10n="U" oldref="46">Long integer variables range from -2147483648 to 2147483647. If you assign a floating-point value to a long integer variable, the decimal places are rounded to the next integer. Long integer variables are rapidly calculated in procedures and are suitable for counter variables in loops for large values. A long integer variable requires four bytes of memory. "&amp;" is the type-declaration character.</paragraph>
-<paragraph role="code" id="par_id3154708" xml-lang="en-US" l10n="U" oldref="48">Dim Variable&amp;</paragraph>
-<paragraph role="code" id="par_id3156365" xml-lang="en-US" l10n="U" oldref="49">Dim Variable as Long</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable&amp;</paragraph>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Long</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id7596972" xml-lang="en-US" level="3" l10n="NEW">Decimal Variables<comment>see i64349</comment></paragraph>
<paragraph role="paragraph" id="par_id2649311" xml-lang="en-US" l10n="NEW">Decimal variables can take positive or negative numbers or zero. Accuracy is up to 29 digits.</paragraph><comment>i85284</comment><paragraph role="paragraph" id="par_id7617114" xml-lang="en-US" l10n="NEW">You can use plus (+) or minus (-) signs as prefixes for decimal numbers (with or without spaces).</paragraph>
<paragraph role="paragraph" id="par_id1593676" xml-lang="en-US" l10n="NEW">If a decimal number is assigned to an integer variable, %PRODUCTNAME Basic rounds the figure up or down.<comment>information from "Programming Guide for BASIC" about decimal variables</comment></paragraph>
<paragraph role="heading" id="hd_id3147500" xml-lang="en-US" level="3" l10n="U" oldref="50">Single Variables</paragraph>
<paragraph role="paragraph" id="par_id3153070" xml-lang="en-US" l10n="U" oldref="51">Single variables can take positive or negative values ranging from 3.402823 x 10E38 to 1.401298 x 10E-45. Single variables are floating-point variables, in which the decimal precision decreases as the non-decimal part of the number increases. Single variables are suitable for mathematical calculations of average precision. Calculations require more time than for Integer variables, but are faster than calculations with Double variables. A Single variable requires 4 bytes of memory. The type-declaration character is "!".</paragraph>
-<paragraph role="code" id="par_id3149875" xml-lang="en-US" l10n="U" oldref="52">Dim Variable!</paragraph>
-<paragraph role="code" id="par_id3153302" xml-lang="en-US" l10n="U" oldref="53">Dim Variable as Single</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable!</paragraph>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Single</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3155753" xml-lang="en-US" level="3" l10n="U" oldref="54">Double Variables</paragraph>
<paragraph role="paragraph" id="par_id3150953" xml-lang="en-US" l10n="U" oldref="55">Double variables can take positive or negative values ranging from 1.79769313486232 x 10E308 to 4.94065645841247 x 10E-324. Double variables are floating-point variables, in which the decimal precision decreases as the non-decimal part of the number increases. Double variables are suitable for precise calculations. Calculations require more time than for Single variables. A Double variable requires 8 bytes of memory. The type-declaration character is "#".</paragraph>
-<paragraph role="code" id="par_id3150431" xml-lang="en-US" l10n="U" oldref="56">Dim Variable#</paragraph>
-<paragraph role="code" id="par_id3154406" xml-lang="en-US" l10n="U" oldref="57">Dim Variable As Double</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable#</paragraph>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Double</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3155747" xml-lang="en-US" level="3" l10n="U" oldref="95">Currency Variables</paragraph>
<paragraph role="paragraph" id="par_id3153337" xml-lang="en-US" l10n="U" oldref="96">Currency variables are internally stored as 64-bit numbers (8 Bytes) and displayed as a fixed-decimal number with 15 non-decimal and 4 decimal places. The values range from -922337203685477.5808 to +922337203685477.5807. Currency variables are used to calculate currency values with a high precision. The type-declaration character is "@".</paragraph>
-<paragraph role="code" id="par_id3147296" xml-lang="en-US" l10n="U" oldref="97">Dim Variable@</paragraph>
-<paragraph role="code" id="par_id3150391" xml-lang="en-US" l10n="U" oldref="98">Dim Variable As Currency</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable@</paragraph>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Currency</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3148742" xml-lang="en-US" level="3" l10n="U" oldref="58">String Variables</paragraph>
<paragraph role="paragraph" id="par_id3151393" xml-lang="en-US" l10n="U" oldref="59">String variables can hold character strings with up to 65,535 characters. Each character is stored as the corresponding Unicode value. String variables are suitable for word processing within programs and for temporary storage of any non-printable character up to a maximum length of 64 Kbytes. The memory required for storing string variables depends on the number of characters in the variable. The type-declaration character is "$".</paragraph>
-<paragraph role="code" id="par_id3166467" xml-lang="en-US" l10n="U" oldref="60">Dim Variable$</paragraph>
-<paragraph role="code" id="par_id3153027" xml-lang="en-US" l10n="U" oldref="61">Dim Variable As String</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable$</paragraph>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As String</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3150534" xml-lang="en-US" level="3" l10n="U" oldref="62">Boolean Variables</paragraph>
<paragraph role="paragraph" id="par_id3145632" xml-lang="en-US" l10n="CHG" oldref="63">Boolean variables store only one of two values: TRUE or FALSE. A number 0 evaluates to FALSE, every other value evaluates to TRUE.</paragraph>
-<paragraph role="code" id="par_id3147615" xml-lang="en-US" l10n="U" oldref="64">Dim Variable As Boolean</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Boolean</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3149722" xml-lang="en-US" level="3" l10n="U" oldref="65">Date Variables</paragraph>
<paragraph role="paragraph" id="par_id3159116" xml-lang="en-US" l10n="U" oldref="66">Date variables can only contain dates and time values stored in an internal format. Values assigned to Date variables with <link href="text/sbasic/shared/03030101.xhp" name="Dateserial"><emph>Dateserial</emph></link>, <link href="text/sbasic/shared/03030102.xhp" name="Datevalue"><emph>Datevalue</emph></link>, <link href="text/sbasic/shared/03030205.xhp" name="Timeserial"><emph>Timeserial</emph></link> or <link href="text/sbasic/shared/03030206.xhp" name="Timevalue"><emph>Timevalue</emph></link> are automatically converted to the internal format. Date-variables are converted to normal numbers by using the <link href="text/sbasic/shared/03030103.xhp" name="Day"><emph>Day</emph></link>, <link href="text/sbasic/shared/03030104.xhp" name="Month"><emph>Month</emph></link>, <link href="text/sbasic/shared/03030106.xhp" name="Year"><emph>Year</emph></link> or the <link href="text/sbasic/shared/03030201.xhp" name="Hour"><emph>Hour</emph></link>, <link href="text/sbasic/shared/03030202.xhp" name="Minute"><emph>Minute</emph></link>, <link href="text/sbasic/shared/03030204.xhp" name="Second"><emph>Second</emph></link> function. The internal format enables a comparison of date/time values by calculating the difference between two numbers. These variables can only be declared with the key word <emph>Date</emph>.</paragraph>
-<paragraph role="code" id="par_id3150462" xml-lang="en-US" l10n="U" oldref="67">Dim Variable As Date</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Variable As Date</paragraph>
+</bascode>
<paragraph role="heading" id="hd_id3148732" xml-lang="en-US" level="2" l10n="U" oldref="68">Initial Variable Values</paragraph>
<paragraph role="paragraph" id="par_id3154549" xml-lang="en-US" l10n="U" oldref="69">As soon as the variable has been declared, it is automatically set to the "Null" value. Note the following conventions:</paragraph>
<paragraph role="paragraph" id="par_id3143222" xml-lang="en-US" l10n="U" oldref="70">
@@ -250,7 +296,9 @@
<table id="tbl_id3155829">
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3150143" xml-lang="en-US" l10n="U" oldref="86">DIM text$(20)</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Text$(20)</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3154567" xml-lang="en-US" l10n="U" oldref="136">21 elements numbered from 0 to 20</paragraph>
@@ -258,7 +306,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3145596" xml-lang="en-US" l10n="U" oldref="125">DIM text$(5,4)</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Text$(5,4)</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3154397" xml-lang="en-US" l10n="U" oldref="137">30 elements (a matrix of 6 x 5 elements)</paragraph>
@@ -266,7 +316,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3149185" xml-lang="en-US" l10n="U" oldref="87">DIM text$(5 to 25)</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Text$(5 To 25)</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3149690" xml-lang="en-US" l10n="U" oldref="138">21 elements numbered from 5 to 25</paragraph>
@@ -274,7 +326,9 @@
</tablerow>
<tablerow>
<tablecell colspan="" rowspan="">
-<paragraph role="code" id="par_id3155950" xml-lang="en-US" l10n="U" oldref="88">DIM text$(-15 to 5)</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Dim Text$(-15 To 5)</paragraph>
+</bascode>
</tablecell>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3153113" xml-lang="en-US" l10n="U" oldref="89">21 elements (including 0), numbered from -15 to 5</paragraph>
@@ -284,6 +338,8 @@
<paragraph role="paragraph" id="par_id3153005" xml-lang="en-US" l10n="CHG" oldref="90">The index range can include positive as well as negative numbers. <comment>i36558</comment></paragraph>
<paragraph role="heading" id="hd_id3154507" xml-lang="en-US" level="2" l10n="U" oldref="91">Constants</paragraph>
<paragraph role="paragraph" id="par_id3156357" xml-lang="en-US" l10n="U" oldref="92">Constants have a fixed value. They are only defined once in the program and cannot be redefined later:</paragraph>
-<paragraph role="code" id="par_id3153203" xml-lang="en-US" l10n="U" oldref="93">CONST ConstName=Expression</paragraph>
+<bascode>
+<paragraph role="bascode" localize="false" xml-lang="en-US">Const ConstName=Expression</paragraph>
+</bascode>
</body>
</helpdocument>