<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Strompf</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Strompf"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Strompf"/>
	<updated>2026-11-28T12:01:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Error_Handling&amp;diff=60056</id>
		<title>Documentation/BASIC Guide/Error Handling</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Error_Handling&amp;diff=60056"/>
		<updated>2008-01-11T02:27:08Z</updated>

		<summary type="html">&lt;p&gt;Strompf: /* Tips for Structured Error Handling */  first example error-handling: Moved the comment line to the line On Error Goto 0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Procedures and Functions&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Runtime Library&lt;br /&gt;
|lang=block&lt;br /&gt;
}}&amp;lt;!-- {{DISPLAYTITLE:Error Handling --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Error Handling =&lt;br /&gt;
&lt;br /&gt;
Correct handling of error situations is one of the most time-consuming tasks of programming. {{OOo}} Basic provides a range of tools for simplifying error handling.&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;tt&amp;gt;On Error&amp;lt;/tt&amp;gt; Instruction ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;On Error&amp;lt;/tt&amp;gt; instruction is the key to any error handling:&lt;br /&gt;
&lt;br /&gt;
 Sub Test&lt;br /&gt;
   On Error Goto ErrorHandler&lt;br /&gt;
   &amp;#039; ... undertake task during which an error may occur&lt;br /&gt;
   Exit Sub&lt;br /&gt;
   ErrorHandler: &lt;br /&gt;
     &amp;#039; ... individual code for error handling&lt;br /&gt;
 End Sub&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;On Error Goto ErrorHandler&amp;lt;/tt&amp;gt; line defines how {{OOo}} Basic proceeds in the event of an error. The &amp;lt;tt&amp;gt;Goto ErrorHandler&amp;lt;/tt&amp;gt; ensures that {{OOo}} Basic exits the current program line and then executes the &amp;lt;tt&amp;gt;ErrorHandler:&amp;lt;/tt&amp;gt; code. &lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;tt&amp;gt;Resume&amp;lt;/tt&amp;gt; Command ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Resume Next&amp;lt;/tt&amp;gt; command continues the program from the line that follows where the error occurred in the program after the code in the error handler has been executed:&lt;br /&gt;
&lt;br /&gt;
 ErrorHandler:&lt;br /&gt;
   &amp;#039; ... individual code for error handling&lt;br /&gt;
   Resume Next&lt;br /&gt;
&lt;br /&gt;
Use the &amp;lt;tt&amp;gt;Resume Proceed&amp;lt;/tt&amp;gt; command to specify a jump point for continuing the program after error handling:&lt;br /&gt;
&lt;br /&gt;
 ErrorHandler:&lt;br /&gt;
   &amp;#039; ... individual code for error handling&lt;br /&gt;
   Resume Proceed&lt;br /&gt;
 &lt;br /&gt;
 Proceed:&lt;br /&gt;
   &amp;#039; ... the program continues here after the error&lt;br /&gt;
&lt;br /&gt;
To continue a program without an error message when an error occurs, use the following format: &lt;br /&gt;
&lt;br /&gt;
 Sub Test&lt;br /&gt;
   On Error Resume Next&lt;br /&gt;
   &amp;#039; ... perform task during which an error may occur&lt;br /&gt;
 End Sub&lt;br /&gt;
&lt;br /&gt;
Use the &amp;lt;tt&amp;gt;On Error Resume Next&amp;lt;/tt&amp;gt; command with caution as its effect is global.&lt;br /&gt;
&lt;br /&gt;
== Queries Regarding Error Information ==&lt;br /&gt;
&lt;br /&gt;
In error handling, it is useful to have a description of the error and to know where and why the error occurred:&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;tt&amp;gt;Err&amp;lt;/tt&amp;gt; variable contains the number of errors that has occurred. &lt;br /&gt;
* The &amp;lt;tt&amp;gt;Error$&amp;lt;/tt&amp;gt; variable contains a description of the error.&lt;br /&gt;
* The &amp;lt;tt&amp;gt;Erl&amp;lt;/tt&amp;gt; variable contains the line number where the error occurred. &lt;br /&gt;
&lt;br /&gt;
The call&lt;br /&gt;
&lt;br /&gt;
 MsgBox &amp;quot;Error &amp;quot; &amp;amp; Err &amp;amp; &amp;quot;: &amp;quot; &amp;amp; Error$ &amp;amp; &amp;quot; (line : &amp;quot; &amp;amp; Erl &amp;amp; &amp;quot;)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
shows how the error information can be displayed in a message window. &lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|Whereas VBA summarizes the error messages in a statistical object called &amp;lt;tt&amp;gt;Err&amp;lt;/tt&amp;gt;, {{OOo}} Basic provides the &amp;lt;tt&amp;gt;Err,&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;Error$&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;Erl&amp;lt;/tt&amp;gt; variables.}}&lt;br /&gt;
&lt;br /&gt;
The status information remains valid until the program encounters a &amp;lt;tt&amp;gt;Resume&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;On Error&amp;lt;/tt&amp;gt; command, whereupon the information is reset. &lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|In VBA, the &amp;lt;tt&amp;gt;Err.Clear&amp;lt;/tt&amp;gt; method of the &amp;lt;tt&amp;gt;Err&amp;lt;/tt&amp;gt; object resets the error status after an error occurs. In {{OOo}} Basic, this is accomplished with the &amp;lt;tt&amp;gt;On Error&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;Resume&amp;lt;/tt&amp;gt; commands. }}&lt;br /&gt;
&lt;br /&gt;
== Tips for Structured Error Handling ==&lt;br /&gt;
&lt;br /&gt;
Both the definition command, &amp;lt;tt&amp;gt;On Error&amp;lt;/tt&amp;gt;, and the return command, &amp;lt;tt&amp;gt;Resume&amp;lt;/tt&amp;gt;, are variants of the &amp;lt;tt&amp;gt;Goto&amp;lt;/tt&amp;gt; construct.&lt;br /&gt;
&lt;br /&gt;
If you want to cleanly structure your code to prevent generating errors when you use this construct, you should not use jump commands without monitoring them.&lt;br /&gt;
&lt;br /&gt;
Care should be taken when you use the &amp;lt;tt&amp;gt;On Error Resume Next&amp;lt;/tt&amp;gt; command as this dismisses all open error messages.&lt;br /&gt;
&lt;br /&gt;
The best solution is to use only one approach for error handling within a program - keep error handling separate from the actual program code and do not jump back to the original code after the error occurs.&lt;br /&gt;
&lt;br /&gt;
The following is an example of an error handling procedure:&lt;br /&gt;
&lt;br /&gt;
 Sub Example&lt;br /&gt;
   &amp;#039; Define error handler at the start of the function &lt;br /&gt;
   On Error Goto ErrorHandler   &lt;br /&gt;
     &amp;#039; ... Here is the actual program code&lt;br /&gt;
   On Error Goto 0           &amp;#039; Deactivate error handling&lt;br /&gt;
     &amp;#039; End of regular program implementation&lt;br /&gt;
   Exit Sub&lt;br /&gt;
&lt;br /&gt;
  &amp;#039; Start point of error handling&lt;br /&gt;
  ErrorHandler:                &lt;br /&gt;
    &amp;#039; Check whether error was expected&lt;br /&gt;
     If Err = ExpectedErrorNo Then   &lt;br /&gt;
       &amp;#039; ... Process error&lt;br /&gt;
     Else&lt;br /&gt;
       &amp;#039; ... Warning of unexpected error&lt;br /&gt;
     End If&lt;br /&gt;
  On Error Goto 0            &amp;#039; Deactivate error handling &lt;br /&gt;
 End Sub&lt;br /&gt;
&lt;br /&gt;
This procedure begins with the definition of an error handler, followed by the actual program code. At the end of the program code, the error handling is deactivated by the &amp;lt;tt&amp;gt;On Error Goto 0&amp;lt;/tt&amp;gt; call and the procedure implementation is ended by the &amp;lt;tt&amp;gt;Exit Sub&amp;lt;/tt&amp;gt; command (not to be confused with &amp;lt;tt&amp;gt;End Sub&amp;lt;/tt&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The example first checks if the error number corresponds to the expected number (as stored in the imaginary &amp;lt;tt&amp;gt;ExpectedErrorNo&amp;lt;/tt&amp;gt; constant) and then handles the error accordingly. If another error occurs, the system outputs a warning. It is important to check the error number so that unanticipated errors can be detected.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;On Error Goto 0&amp;lt;/tt&amp;gt; call at the end of the code resets the status information of the error (the error code in the &amp;lt;tt&amp;gt;Err&amp;lt;/tt&amp;gt; system variables) so that an error occurring at a later date can be clearly recognized.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Strompf</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Numbers&amp;diff=60049</id>
		<title>Documentation/BASIC Guide/Numbers</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Numbers&amp;diff=60049"/>
		<updated>2008-01-11T01:35:20Z</updated>

		<summary type="html">&lt;p&gt;Strompf: /* Floats */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Strings&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Boolean&lt;br /&gt;
|lang=block&lt;br /&gt;
}}&amp;lt;!-- {{DISPLAYTITLE:Numbers --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Numbers =&lt;br /&gt;
{{OOo}} Basic supports five basic types for processing numbers:&lt;br /&gt;
&lt;br /&gt;
* Integer&lt;br /&gt;
* Long Integer&lt;br /&gt;
* Single&lt;br /&gt;
* Double&lt;br /&gt;
* Currency&lt;br /&gt;
&lt;br /&gt;
== Integer Variables ==&lt;br /&gt;
&lt;br /&gt;
Integer variables can store any whole number between &amp;#039;&amp;#039;&amp;#039;-32768&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;32767&amp;#039;&amp;#039;&amp;#039;. An integer variable can take up to two bytes of memory. The type declaration symbol for an integer variable is &amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt;. Calculations that use integer variables are very fast and are particularly useful for loop counters. If you assign a floating point number to an integer variable, the number is rounded up or down to the next whole number.&lt;br /&gt;
&lt;br /&gt;
Example declarations for integer variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As Integer&lt;br /&gt;
 Dim Variable%&lt;br /&gt;
&lt;br /&gt;
== Long Integer Variables ==&lt;br /&gt;
&lt;br /&gt;
Long integer variables can store any whole number between &amp;#039;&amp;#039;&amp;#039;–2147483648&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;2147483647&amp;#039;&amp;#039;&amp;#039;. A long integer variable can takes up to four bytes of memory. The type declaration symbol for a long integer is &amp;lt;tt&amp;gt;&amp;amp;&amp;lt;/tt&amp;gt;. Calculations with long integer variables are very fast and are particularly useful for loop counters. If you assign a floating point number to a long integer variable, the number is rounded up or down to the next whole number.&lt;br /&gt;
&lt;br /&gt;
Example declarations for long integer variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable as Long&lt;br /&gt;
 Dim Variable&amp;amp;&lt;br /&gt;
&lt;br /&gt;
== Single Variables ==&lt;br /&gt;
&lt;br /&gt;
Single variables can store any positive or negative floating point number between &amp;#039;&amp;#039;&amp;#039;3.402823 x 10&amp;lt;sup&amp;gt;38&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;1.401298 x 10&amp;lt;sup&amp;gt;-45&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039;. A single variable can take up to four bytes of memory. The type declaration symbol for a single variable is &amp;lt;tt&amp;gt;!&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Originally, single variables were used to reduce the computing time required for the more precise double variables. However, these speed considerations no longer apply, reducing the need for single variables.&lt;br /&gt;
&lt;br /&gt;
Example declarations for single variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable as Single&lt;br /&gt;
 Dim Variable!&lt;br /&gt;
&lt;br /&gt;
== Double Variables ==&lt;br /&gt;
&lt;br /&gt;
Double variables can store any positive or negative floating point numbers between &amp;#039;&amp;#039;&amp;#039;1.79769313486232 x 10&amp;lt;sup&amp;gt;308&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;4.94065645841247 x 10&amp;lt;sup&amp;gt;-324&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039;. A double variable can take up to eight bytes of memory. Double variables are suitable for precise calculations. The type declaration symbol is &amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Example declarations of double variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As Double&lt;br /&gt;
 Dim Variable#&lt;br /&gt;
&lt;br /&gt;
== Currency Variables ==&lt;br /&gt;
&lt;br /&gt;
Currency variables differ from the other variable types by the way they handle values. The decimal point is fixed and is followed by four decimal places. The variable can contain up to 15 numbers before the decimal point. A currency variable can store any value between &amp;#039;&amp;#039;&amp;#039;—922337203685477.5808&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;+922337203685477.5807&amp;#039;&amp;#039;&amp;#039; and takes up to eight bytes of memory. The type declaration symbol for a currency variable is &amp;lt;tt&amp;gt;@&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Currency variables are mostly intended for business calculations that yield unforeseeable rounding errors due to the use of floating point numbers.&lt;br /&gt;
&lt;br /&gt;
Example declarations of currency variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As Currency&lt;br /&gt;
 Dim Variable@&lt;br /&gt;
&lt;br /&gt;
== Floats ==&lt;br /&gt;
&lt;br /&gt;
The types single, double and currency are often collectively referred to as floats, or floating-point number types. They can contain numerical values with decimal fractions of various length, hence the name: The decimal point seems to be able to &amp;#039;float&amp;#039; through the number.&lt;br /&gt;
&lt;br /&gt;
You can straightforwardly declare variables of the type float. The actual variable type (single, long, currency) is determined the moment a value is assigned to the variable:&lt;br /&gt;
&lt;br /&gt;
 Dim A As Float&lt;br /&gt;
 A = 1210.126&lt;br /&gt;
&lt;br /&gt;
== Specification of Explicit Numbers ==&lt;br /&gt;
&lt;br /&gt;
Numbers can be presented in several ways, for example, in decimal format or in scientific notation, or even with a different base than the decimal system. The following rules apply to numerical characters in {{OOo}} Basic:&lt;br /&gt;
&lt;br /&gt;
=== Whole Numbers ===&lt;br /&gt;
&lt;br /&gt;
The simplest method is to work with whole numbers. They are listed in the source text without a comma separating the thousand figure:&lt;br /&gt;
&lt;br /&gt;
 Dim A As Integer&lt;br /&gt;
 Dim B As Float&lt;br /&gt;
 &lt;br /&gt;
 A = 1210&lt;br /&gt;
 B = 2438&lt;br /&gt;
&lt;br /&gt;
The numbers can be preceded by both a plus (+) or minus (-) sign (with or without a space in between):&lt;br /&gt;
&lt;br /&gt;
 Dim A As Integer&lt;br /&gt;
 Dim B As Float&lt;br /&gt;
 &lt;br /&gt;
 A = + 121&lt;br /&gt;
 B = - 243&lt;br /&gt;
&lt;br /&gt;
=== Decimal Numbers ===&lt;br /&gt;
&lt;br /&gt;
When you type a decimal number, use a period (.) as the decimal point. This rule ensures that source texts can be transferred from one country to another without conversion.&lt;br /&gt;
&lt;br /&gt;
 Dim A As Integer&lt;br /&gt;
 Dim B As Integer&lt;br /&gt;
 Dim C As Float&lt;br /&gt;
 &lt;br /&gt;
 A = 1223.53      &amp;#039; is rounded&lt;br /&gt;
 B = - 23446.46   &amp;#039; is rounded&lt;br /&gt;
 C = + 3532.76323&lt;br /&gt;
&lt;br /&gt;
You can also use plus (+) or minus (-) signs as prefixes for decimal numbers (again with or without spaces).&lt;br /&gt;
&lt;br /&gt;
If a decimal number is assigned to an integer variable, {{OOo}} Basic rounds the figure up or down.&lt;br /&gt;
&lt;br /&gt;
=== Exponential Writing Style ===&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic allows numbers to be specified in the exponential writing style, for example, you can write &amp;lt;tt&amp;gt;1.5e-10&amp;lt;/tt&amp;gt; for the number 1.5 x 10&amp;lt;sup&amp;gt;-10&amp;lt;/sup&amp;gt; (0.00000000015). The letter &amp;quot;e&amp;quot; can be lowercase or uppercase with or without a plus sign (+) as a prefix.&lt;br /&gt;
&lt;br /&gt;
Here are a few correct and incorrect examples of numbers in exponential format:&lt;br /&gt;
&lt;br /&gt;
 Dim A As Double&lt;br /&gt;
 &lt;br /&gt;
 A = 1.43E2    &amp;#039; Correct&lt;br /&gt;
 A = + 1.43E2  &amp;#039; Correct (space between plus and basic number)&lt;br /&gt;
 A = - 1.43E2  &amp;#039; Correct (space between minus and basic number)&lt;br /&gt;
 A = 1.43E-2   &amp;#039; Correct (negative exponent)&lt;br /&gt;
 A = 1.43E -2  &amp;#039; Incorrect (spaces not permitted within the number)&lt;br /&gt;
 A = 1,43E-2   &amp;#039; Incorrect (commas not permitted as decimal points)&lt;br /&gt;
 A = 1.43E2.2  &amp;#039; Incorrect (exponent must be a whole number)&lt;br /&gt;
&lt;br /&gt;
Note, that in the first and third incorrect examples that no error message is generated even though the variables return incorrect values. The expression&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E -2&lt;br /&gt;
&lt;br /&gt;
is interpreted as 1.43 minus 2, which corresponds to the value -0.57. However, the value 1.43 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt; (corresponding to 0.0143) was the intended value. With the value&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E2.2&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic ignores the part of the exponent after the decimal point and interprets the expression as&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E2&lt;br /&gt;
&lt;br /&gt;
=== Hexadecimal Values ===&lt;br /&gt;
&lt;br /&gt;
In the hexadecimal system (base 16 system), a 2-digit number corresponds to precisely one byte. This allows numbers to be handled in a manner which more closely reflects machine architecture. In the hexadecimal system, the numbers 0 to 9 and the letters A to F are used as numbers. An A stands for the decimal number 10, while the letter F represents the decimal number 15. {{OOo}} Basic lets you use whole numbered hexadecimal values, so long as they are preceded by &amp;lt;tt&amp;gt;&amp;amp;H&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Dim A As Long&lt;br /&gt;
 A = &amp;amp;HFF &amp;#039; Hexadecimal value FF, corresponds to the decimal value 255&lt;br /&gt;
 A = &amp;amp;H10 &amp;#039; Hexadecimal value 10, corresponds to the decimal value 16&lt;br /&gt;
&lt;br /&gt;
=== Octal Values ===&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic also understands the octal system (base 8 system), which uses the numbers 0 to 7. You must use whole numbers that are preceded by &amp;lt;tt&amp;gt;&amp;amp;O&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Dim A As Long&lt;br /&gt;
 A = &amp;amp;O77 &amp;#039; Octal value 77, corresponds to the decimal value 63&lt;br /&gt;
 A = &amp;amp;O10 &amp;#039; Octal value 10, corresponds to the decimal value 8&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Strompf</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Numbers&amp;diff=60048</id>
		<title>Documentation/BASIC Guide/Numbers</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Numbers&amp;diff=60048"/>
		<updated>2008-01-11T01:34:21Z</updated>

		<summary type="html">&lt;p&gt;Strompf: /* Numbers */ : Added paragraph + example about floats&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Strings&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Boolean&lt;br /&gt;
|lang=block&lt;br /&gt;
}}&amp;lt;!-- {{DISPLAYTITLE:Numbers --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Numbers =&lt;br /&gt;
{{OOo}} Basic supports five basic types for processing numbers:&lt;br /&gt;
&lt;br /&gt;
* Integer&lt;br /&gt;
* Long Integer&lt;br /&gt;
* Single&lt;br /&gt;
* Double&lt;br /&gt;
* Currency&lt;br /&gt;
&lt;br /&gt;
== Integer Variables ==&lt;br /&gt;
&lt;br /&gt;
Integer variables can store any whole number between &amp;#039;&amp;#039;&amp;#039;-32768&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;32767&amp;#039;&amp;#039;&amp;#039;. An integer variable can take up to two bytes of memory. The type declaration symbol for an integer variable is &amp;lt;tt&amp;gt;%&amp;lt;/tt&amp;gt;. Calculations that use integer variables are very fast and are particularly useful for loop counters. If you assign a floating point number to an integer variable, the number is rounded up or down to the next whole number.&lt;br /&gt;
&lt;br /&gt;
Example declarations for integer variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As Integer&lt;br /&gt;
 Dim Variable%&lt;br /&gt;
&lt;br /&gt;
== Long Integer Variables ==&lt;br /&gt;
&lt;br /&gt;
Long integer variables can store any whole number between &amp;#039;&amp;#039;&amp;#039;–2147483648&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;2147483647&amp;#039;&amp;#039;&amp;#039;. A long integer variable can takes up to four bytes of memory. The type declaration symbol for a long integer is &amp;lt;tt&amp;gt;&amp;amp;&amp;lt;/tt&amp;gt;. Calculations with long integer variables are very fast and are particularly useful for loop counters. If you assign a floating point number to a long integer variable, the number is rounded up or down to the next whole number.&lt;br /&gt;
&lt;br /&gt;
Example declarations for long integer variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable as Long&lt;br /&gt;
 Dim Variable&amp;amp;&lt;br /&gt;
&lt;br /&gt;
== Single Variables ==&lt;br /&gt;
&lt;br /&gt;
Single variables can store any positive or negative floating point number between &amp;#039;&amp;#039;&amp;#039;3.402823 x 10&amp;lt;sup&amp;gt;38&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;1.401298 x 10&amp;lt;sup&amp;gt;-45&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039;. A single variable can take up to four bytes of memory. The type declaration symbol for a single variable is &amp;lt;tt&amp;gt;!&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Originally, single variables were used to reduce the computing time required for the more precise double variables. However, these speed considerations no longer apply, reducing the need for single variables.&lt;br /&gt;
&lt;br /&gt;
Example declarations for single variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable as Single&lt;br /&gt;
 Dim Variable!&lt;br /&gt;
&lt;br /&gt;
== Double Variables ==&lt;br /&gt;
&lt;br /&gt;
Double variables can store any positive or negative floating point numbers between &amp;#039;&amp;#039;&amp;#039;1.79769313486232 x 10&amp;lt;sup&amp;gt;308&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;4.94065645841247 x 10&amp;lt;sup&amp;gt;-324&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039;. A double variable can take up to eight bytes of memory. Double variables are suitable for precise calculations. The type declaration symbol is &amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Example declarations of double variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As Double&lt;br /&gt;
 Dim Variable#&lt;br /&gt;
&lt;br /&gt;
== Currency Variables ==&lt;br /&gt;
&lt;br /&gt;
Currency variables differ from the other variable types by the way they handle values. The decimal point is fixed and is followed by four decimal places. The variable can contain up to 15 numbers before the decimal point. A currency variable can store any value between &amp;#039;&amp;#039;&amp;#039;—922337203685477.5808&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;+922337203685477.5807&amp;#039;&amp;#039;&amp;#039; and takes up to eight bytes of memory. The type declaration symbol for a currency variable is &amp;lt;tt&amp;gt;@&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Currency variables are mostly intended for business calculations that yield unforeseeable rounding errors due to the use of floating point numbers.&lt;br /&gt;
&lt;br /&gt;
Example declarations of currency variables:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As Currency&lt;br /&gt;
 Dim Variable@&lt;br /&gt;
&lt;br /&gt;
== Floats ==&lt;br /&gt;
&lt;br /&gt;
The types single, double and currency are often collectively referred to as floats, or floating-point number types. They can contain numerical values with decimal fractions of various length, hence the name: The decimal point seems to be able to &amp;#039;float&amp;#039; through the number.&lt;br /&gt;
&lt;br /&gt;
You can straightforwardly declare variables of the type float. The actual variable type (single, long, currency) is determined the moment a value is assigned to the variable:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Dim A As Float&lt;br /&gt;
 A = 1210.126&lt;br /&gt;
&lt;br /&gt;
== Specification of Explicit Numbers ==&lt;br /&gt;
&lt;br /&gt;
Numbers can be presented in several ways, for example, in decimal format or in scientific notation, or even with a different base than the decimal system. The following rules apply to numerical characters in {{OOo}} Basic:&lt;br /&gt;
&lt;br /&gt;
=== Whole Numbers ===&lt;br /&gt;
&lt;br /&gt;
The simplest method is to work with whole numbers. They are listed in the source text without a comma separating the thousand figure:&lt;br /&gt;
&lt;br /&gt;
 Dim A As Integer&lt;br /&gt;
 Dim B As Float&lt;br /&gt;
 &lt;br /&gt;
 A = 1210&lt;br /&gt;
 B = 2438&lt;br /&gt;
&lt;br /&gt;
The numbers can be preceded by both a plus (+) or minus (-) sign (with or without a space in between):&lt;br /&gt;
&lt;br /&gt;
 Dim A As Integer&lt;br /&gt;
 Dim B As Float&lt;br /&gt;
 &lt;br /&gt;
 A = + 121&lt;br /&gt;
 B = - 243&lt;br /&gt;
&lt;br /&gt;
=== Decimal Numbers ===&lt;br /&gt;
&lt;br /&gt;
When you type a decimal number, use a period (.) as the decimal point. This rule ensures that source texts can be transferred from one country to another without conversion.&lt;br /&gt;
&lt;br /&gt;
 Dim A As Integer&lt;br /&gt;
 Dim B As Integer&lt;br /&gt;
 Dim C As Float&lt;br /&gt;
 &lt;br /&gt;
 A = 1223.53      &amp;#039; is rounded&lt;br /&gt;
 B = - 23446.46   &amp;#039; is rounded&lt;br /&gt;
 C = + 3532.76323&lt;br /&gt;
&lt;br /&gt;
You can also use plus (+) or minus (-) signs as prefixes for decimal numbers (again with or without spaces).&lt;br /&gt;
&lt;br /&gt;
If a decimal number is assigned to an integer variable, {{OOo}} Basic rounds the figure up or down.&lt;br /&gt;
&lt;br /&gt;
=== Exponential Writing Style ===&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic allows numbers to be specified in the exponential writing style, for example, you can write &amp;lt;tt&amp;gt;1.5e-10&amp;lt;/tt&amp;gt; for the number 1.5 x 10&amp;lt;sup&amp;gt;-10&amp;lt;/sup&amp;gt; (0.00000000015). The letter &amp;quot;e&amp;quot; can be lowercase or uppercase with or without a plus sign (+) as a prefix.&lt;br /&gt;
&lt;br /&gt;
Here are a few correct and incorrect examples of numbers in exponential format:&lt;br /&gt;
&lt;br /&gt;
 Dim A As Double&lt;br /&gt;
 &lt;br /&gt;
 A = 1.43E2    &amp;#039; Correct&lt;br /&gt;
 A = + 1.43E2  &amp;#039; Correct (space between plus and basic number)&lt;br /&gt;
 A = - 1.43E2  &amp;#039; Correct (space between minus and basic number)&lt;br /&gt;
 A = 1.43E-2   &amp;#039; Correct (negative exponent)&lt;br /&gt;
 A = 1.43E -2  &amp;#039; Incorrect (spaces not permitted within the number)&lt;br /&gt;
 A = 1,43E-2   &amp;#039; Incorrect (commas not permitted as decimal points)&lt;br /&gt;
 A = 1.43E2.2  &amp;#039; Incorrect (exponent must be a whole number)&lt;br /&gt;
&lt;br /&gt;
Note, that in the first and third incorrect examples that no error message is generated even though the variables return incorrect values. The expression&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E -2&lt;br /&gt;
&lt;br /&gt;
is interpreted as 1.43 minus 2, which corresponds to the value -0.57. However, the value 1.43 x 10&amp;lt;sup&amp;gt;-2&amp;lt;/sup&amp;gt; (corresponding to 0.0143) was the intended value. With the value&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E2.2&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic ignores the part of the exponent after the decimal point and interprets the expression as&lt;br /&gt;
&lt;br /&gt;
 A = 1.43E2&lt;br /&gt;
&lt;br /&gt;
=== Hexadecimal Values ===&lt;br /&gt;
&lt;br /&gt;
In the hexadecimal system (base 16 system), a 2-digit number corresponds to precisely one byte. This allows numbers to be handled in a manner which more closely reflects machine architecture. In the hexadecimal system, the numbers 0 to 9 and the letters A to F are used as numbers. An A stands for the decimal number 10, while the letter F represents the decimal number 15. {{OOo}} Basic lets you use whole numbered hexadecimal values, so long as they are preceded by &amp;lt;tt&amp;gt;&amp;amp;H&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Dim A As Long&lt;br /&gt;
 A = &amp;amp;HFF &amp;#039; Hexadecimal value FF, corresponds to the decimal value 255&lt;br /&gt;
 A = &amp;amp;H10 &amp;#039; Hexadecimal value 10, corresponds to the decimal value 16&lt;br /&gt;
&lt;br /&gt;
=== Octal Values ===&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic also understands the octal system (base 8 system), which uses the numbers 0 to 7. You must use whole numbers that are preceded by &amp;lt;tt&amp;gt;&amp;amp;O&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Dim A As Long&lt;br /&gt;
 A = &amp;amp;O77 &amp;#039; Octal value 77, corresponds to the decimal value 63&lt;br /&gt;
 A = &amp;amp;O10 &amp;#039; Octal value 10, corresponds to the decimal value 8&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Strompf</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Strings&amp;diff=60045</id>
		<title>Documentation/BASIC Guide/Strings</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Strings&amp;diff=60045"/>
		<updated>2008-01-11T01:13:18Z</updated>

		<summary type="html">&lt;p&gt;Strompf: Added a space in the splitted string: &amp;quot;...that is &amp;quot; + _&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Working With Variables&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Numbers&lt;br /&gt;
|lang=block&lt;br /&gt;
}}&amp;lt;!-- {{DISPLAYTITLE:Strings --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Strings=&lt;br /&gt;
&lt;br /&gt;
Strings, together with numbers, form the most important basic types of {{OOo}} Basic. A string consists of a sequence of consecutive individual characters. The computer saves the strings internally as a sequence of numbers where each number represents one specific character.&lt;br /&gt;
&lt;br /&gt;
==From a Set of ASCII Characters to Unicode==&lt;br /&gt;
&lt;br /&gt;
Character sets match characters in a string with a corresponding code (numbers and characters) in a table that describes how the computer is to display the string.&lt;br /&gt;
&lt;br /&gt;
===The ASCII Character Set===&lt;br /&gt;
&lt;br /&gt;
The ASCII character set is a set of codes that represent numbers, characters, and special symbols by one byte. The 0 to 127 ASCII codes correspond to the alphabet and to common symbols (such as periods, parentheses, and commas), as well as some special screen and printer control codes. The ASCII character set is commonly used as a standard format for transferring text data between computers. &lt;br /&gt;
&lt;br /&gt;
However, this character set does not include a range of special characters used in Europe, such as â, ä, and î, as well as other character formats, such as the Cyrillic alphabet.&lt;br /&gt;
&lt;br /&gt;
===The ANSI Character Set===&lt;br /&gt;
&lt;br /&gt;
Microsoft based its Windows product on the American National Standards Institute (ANSI) character set, which was gradually extended to include characters that are missing from the ASCII character set.&lt;br /&gt;
&lt;br /&gt;
===Code Pages===&lt;br /&gt;
&lt;br /&gt;
The ISO 8859 character sets provide an international standard. The first 128 characters of the ISO character set correspond to the ASCII character set. The ISO standard introduces new character sets (&amp;#039;&amp;#039;&amp;#039;code pages&amp;#039;&amp;#039;&amp;#039; ) so that more languages can be correctly displayed. However, as a result, the same character value can represent different characters in different languages.&lt;br /&gt;
&lt;br /&gt;
===Unicode===&lt;br /&gt;
&lt;br /&gt;
Unicode increases the length of a character to four bytes and combines different character sets to create a standard to depict as many of the world&amp;#039;s languages as possible. Version 2.0 of Unicode is now supported by many programs — including {{OOo}} and {{OOo}} Basic.&lt;br /&gt;
&lt;br /&gt;
==String Variables==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic saves strings as string variables in Unicode. A string variable can store up to 65535 characters. Internally, {{OOo}} Basic saves the associated Unicode value for every character. The working memory needed for a string variable depends on the length of the string.&lt;br /&gt;
&lt;br /&gt;
Example declaration of a string variable:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable As String&lt;br /&gt;
&lt;br /&gt;
You can also write this declaration as:&lt;br /&gt;
&lt;br /&gt;
 Dim Variable$&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|When porting VBA applications, ensure that the maximum allowed string length in {{OOo}} Basic is observed (65535 characters).}}&lt;br /&gt;
&lt;br /&gt;
==Specification of Explicit Strings==&lt;br /&gt;
&lt;br /&gt;
To assign an explicit string to a string variable, enclose the string in quotation marks (&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
 Dim MyString As String&lt;br /&gt;
 MyString = &amp;quot; This is a test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To split a string across two lines, add a plus sign at the end of the first line:&lt;br /&gt;
&lt;br /&gt;
 Dim MyString As String&lt;br /&gt;
 MyString =   &amp;quot;This string is so long that it &amp;quot; + _&lt;br /&gt;
              &amp;quot;has been split over two lines.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To include a quotation mark (&amp;quot;) in a string, enter it twice at the relevant point:&lt;br /&gt;
&lt;br /&gt;
 Dim MyString As String&lt;br /&gt;
 MyString = &amp;quot;a &amp;quot;&amp;quot;-quotation mark.&amp;quot;    &amp;#039; produces a &amp;quot;-quotation mark&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Strompf</name></author>
	</entry>
</feed>