<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fconversion_functions_runtime_library</id>
	<title>EN/documentation/basic guide/conversion functions runtime library - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fconversion_functions_runtime_library"/>
	<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;action=history"/>
	<updated>2026-11-11T13:50:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=16736&amp;oldid=prev</id>
		<title>Sancho at 07:48, 6 September 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=16736&amp;oldid=prev"/>
		<updated>2011-09-06T07:48:24Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 07:48, 6 September 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l159&quot; &gt;Line 159:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 159:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;IsBoolean&amp;lt;/tt&amp;gt; function defines an internal &amp;lt;tt&amp;gt;Dummy&amp;lt;/tt&amp;gt; help variable of the Boolean type and tries to assign this to the transferred value. If assignment is successful, the function returns &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;. If it fails, a runtime error is produced, the error handler intercepts the error, and the function returns &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The &amp;lt;tt&amp;gt;IsBoolean&amp;lt;/tt&amp;gt; function defines an internal &amp;lt;tt&amp;gt;Dummy&amp;lt;/tt&amp;gt; help variable of the Boolean type and tries to assign this to the transferred value. If assignment is successful, the function returns &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;. If it fails, a runtime error is produced, the error handler intercepts the error, and the function returns &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Documentation/&lt;/del&gt;VBAnote|If a string in {{OOo}} Basic contains a non-numerical value and if this is assigned to a number, {{OOo}} Basic does not produce an error message, but stops converting the string at the first invalid character. This procedure differs from VBA. There, an error is triggered and program implementation terminated if a corresponding assignment is executed.}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{VBAnote|If a string in {{OOo}} Basic contains a non-numerical value and if this is assigned to a number, {{OOo}} Basic does not produce an error message, but stops converting the string at the first invalid character. This procedure differs from VBA. There, an error is triggered and program implementation terminated if a corresponding assignment is executed.}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{PDL1}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{PDL1}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=15931&amp;oldid=prev</id>
		<title>Sancho at 16:42, 2 September 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=15931&amp;oldid=prev"/>
		<updated>2011-09-02T16:42:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 16:42, 2 September 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l5&quot; &gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|ShowPrevPage=block&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|ShowPrevPage=block&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|PrevPage=EN/documentation/basic_guide/runtime_library&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|PrevPage=EN/documentation/basic_guide/runtime_library&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|NextPage=EN/documentation/basic_guide/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;strings_(runtime_library)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|NextPage=EN/documentation/basic_guide/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;strings_runtime_library&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|runtime=block&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|runtime=block&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=15927&amp;oldid=prev</id>
		<title>Sancho: moved EN/documentation/basic guide/conversion functions (runtime library) to EN/documentation/basic guide/conversion functions runtime library</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=15927&amp;oldid=prev"/>
		<updated>2011-09-02T16:32:50Z</updated>

		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/index.php?title=EN/documentation/basic_guide/conversion_functions_(runtime_library)&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;EN/documentation/basic guide/conversion functions (runtime library) (page does not exist)&quot;&gt;EN/documentation/basic guide/conversion functions (runtime library)&lt;/a&gt; to &lt;a href=&quot;/wiki/EN/documentation/basic_guide/conversion_functions_runtime_library&quot; title=&quot;EN/documentation/basic guide/conversion functions runtime library&quot;&gt;EN/documentation/basic guide/conversion functions runtime library&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 16:32, 2 September 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=15876&amp;oldid=prev</id>
		<title>Sancho: Created page with &quot;&lt;section begin=title /&gt;&lt;noinclude&gt;{{DISPLAYTITLE:&lt;/noinclude&gt;Conversion Functions ({{OOo}} Runtime Library)&lt;noinclude&gt;}}&lt;/noinclude&gt;&lt;section end=title /&gt;{{BreadCrumbL10n}}  {{Doc...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/conversion_functions_runtime_library&amp;diff=15876&amp;oldid=prev"/>
		<updated>2011-09-01T13:14:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Conversion Functions ({{OOo}} Runtime Library)&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}  {{Doc...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Conversion Functions ({{OOo}} Runtime Library)&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/BASICGuideTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=EN/documentation/basic_guide/runtime_library&lt;br /&gt;
|NextPage=EN/documentation/basic_guide/strings_(runtime_library)&lt;br /&gt;
|runtime=block&lt;br /&gt;
}}&lt;br /&gt;
 &lt;br /&gt;
In many situations, circumstances arise in which a variable of one type has to be changed into a variable of another type. &lt;br /&gt;
&lt;br /&gt;
== Implicit and Explicit Type Conversions ==&lt;br /&gt;
&lt;br /&gt;
The easiest way to change a variable from one type to another is to use an assignment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As String&lt;br /&gt;
Dim B As Integer&lt;br /&gt;
&lt;br /&gt;
B = 101 &lt;br /&gt;
A = B&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, variable &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; is a string, and variable &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; is an integer. {{OOo}} Basic ensures that variable &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; is converted to a string during assignment to variable &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;. This conversion is much more elaborate than it appears: the integer &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; remains in the working memory in the form of a two-byte long number. &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, on the other hand, is a string, and the computer saves a one- or two-byte long value for each character (each number). Therefore, before copying the content from &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; has to be converted into &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;'s internal format. &lt;br /&gt;
&lt;br /&gt;
Unlike most other programming languages, Basic performs type conversion automatically. However, this may have fatal consequences. Upon closer inspection, the following code sequence&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As String&lt;br /&gt;
Dim B As Integer&lt;br /&gt;
Dim C As Integer&lt;br /&gt;
&lt;br /&gt;
B = 1 &lt;br /&gt;
C = 1&lt;br /&gt;
A = B + C&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which at first glance seems straightforward, ultimately proves to be something of a trap. The Basic interpreter first calculates the result of the addition process and then converts this into a string, which, as its result, produces the string 2.&lt;br /&gt;
&lt;br /&gt;
If, on the other hand, the Basic interpreter first converts the start values &amp;lt;tt&amp;gt;B&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;C&amp;lt;/tt&amp;gt; into a string and applies the plus operator to the result, it produces the string &amp;lt;tt&amp;gt;11&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
The same applies when using variant variables: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A &lt;br /&gt;
Dim B &lt;br /&gt;
Dim C &lt;br /&gt;
&lt;br /&gt;
B = 1 &lt;br /&gt;
C = &amp;quot;1&amp;quot;&lt;br /&gt;
A = B + C&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since variant variables may contain both numbers and strings, it is unclear whether variable &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; is assigned the number 2 or the string 11. &lt;br /&gt;
&lt;br /&gt;
The error sources noted for implicit type conversions can only be avoided by careful programming; for example, by not using the variant data type.&lt;br /&gt;
&lt;br /&gt;
To avoid other errors resulting from implicit type conversions, {{OOo}} Basic offers a range of conversion functions, which you can use to define when the data type of an operation should be converted: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;CStr(Var)&amp;lt;/tt&amp;gt;:converts any data type into a string.&lt;br /&gt;
;&amp;lt;tt&amp;gt;CInt(Var)&amp;lt;/tt&amp;gt;:converts any data types into an integer value.&lt;br /&gt;
;&amp;lt;tt&amp;gt;CLng(Var)&amp;lt;/tt&amp;gt;:converts any data types into a long value.&lt;br /&gt;
;&amp;lt;tt&amp;gt;CSng(Var) &amp;lt;/tt&amp;gt;:converts any data types into a single value.&lt;br /&gt;
;&amp;lt;tt&amp;gt;CDbl(Var)&amp;lt;/tt&amp;gt;:converts any data types into a double value.&lt;br /&gt;
;&amp;lt;tt&amp;gt;CBool(Var)&amp;lt;/tt&amp;gt;:converts any data types into a Boolean value.&lt;br /&gt;
;&amp;lt;tt&amp;gt;CDate(Var)&amp;lt;/tt&amp;gt;:converts any data types into a date value.&lt;br /&gt;
&lt;br /&gt;
You can use these conversion functions to define how {{OOo}} Basic should perform these type conversion operations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As String&lt;br /&gt;
Dim B As Integer&lt;br /&gt;
Dim C As Integer&lt;br /&gt;
&lt;br /&gt;
B = 1 &lt;br /&gt;
C = 1&lt;br /&gt;
A = CStr(B + C)         ' B and C are added together first, then&lt;br /&gt;
                        ' converted to the string &amp;quot;2&amp;quot;&lt;br /&gt;
A = CStr(B) + CStr(C)   ' B and C are converted into a string,then&lt;br /&gt;
                        ' combined to produce the string &amp;quot;11&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During the first addition in the example, {{OOo}} Basic first adds the integer variables and then converts the result into a chain of characters. &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; is assigned the string &amp;lt;tt&amp;gt;2&amp;lt;/tt&amp;gt;. In the second instance, the integer variables are first converted into two strings and then linked with one another by means of the assignment. &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; is therefore assigned the string &amp;lt;tt&amp;gt;11&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The numerical &amp;lt;tt&amp;gt;CSng&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;CDbl&amp;lt;/tt&amp;gt; conversion functions also accept decimal numbers. The symbol defined in the corresponding country-specific settings must be used as the decimal point symbol. Conversely, the &amp;lt;tt&amp;gt;CStr&amp;lt;/tt&amp;gt; methods use the currently selected country-specific settings when formatting numbers, dates and time details. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Val&amp;lt;/tt&amp;gt; function is different from the &amp;lt;tt&amp;gt;Csng, Cdbl&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Cstr&amp;lt;/tt&amp;gt; methods. It converts a string into a number; however it always expects a period to be used as the decimal point symbol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As String&lt;br /&gt;
Dim B As Double&lt;br /&gt;
&lt;br /&gt;
A = &amp;quot;2.22&amp;quot;&lt;br /&gt;
B = Val(A)      ' Is converted correctly regardless of the&lt;br /&gt;
                ' country-specific settings&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Checking the Content of Variables ==&lt;br /&gt;
&lt;br /&gt;
In some instances, the date cannot be converted: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As String&lt;br /&gt;
Dim B As Date&lt;br /&gt;
&lt;br /&gt;
A = &amp;quot;test&amp;quot;&lt;br /&gt;
B = A            ' Creates error message&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the example shown, the assignment of the &amp;lt;tt&amp;gt;test&amp;lt;/tt&amp;gt; string to a date variable makes no sense, so the Basic interpreter reports an error. The same applies when attempting to assign a string to a Boolean variable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim A As String&lt;br /&gt;
Dim B As Boolean&lt;br /&gt;
&lt;br /&gt;
A = &amp;quot;test&amp;quot;&lt;br /&gt;
B = A            ' Creates error message&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, the basic interpreter reports an error. &lt;br /&gt;
&lt;br /&gt;
These error messages can be avoided by checking the program before an assignment, in order to establish whether the content of the variable to be assigned matches the type of the target variable. {{OOo}} Basic provides the following test functions for this purpose:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsNumeric(Value)&amp;lt;/tt&amp;gt;:checks whether a value is a number. &lt;br /&gt;
;&amp;lt;tt&amp;gt;IsDate(Value)&amp;lt;/tt&amp;gt;:checks whether a value is a date.&lt;br /&gt;
;&amp;lt;tt&amp;gt;IsArray(Value)&amp;lt;/tt&amp;gt;:checks whether a value is an array.&lt;br /&gt;
&lt;br /&gt;
These functions are especially useful when querying user input. For example, you can check whether a user has typed a valid number or date.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
If IsNumeric(UserInput) Then&lt;br /&gt;
  ValidInput = UserInput&lt;br /&gt;
Else&lt;br /&gt;
  ValidInput = 0&lt;br /&gt;
  MsgBox &amp;quot;Error message.&amp;quot;&lt;br /&gt;
End If&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the previous example, if the &amp;lt;tt&amp;gt;UserInput&amp;lt;/tt&amp;gt; variable contains a valid numerical value, then this is assigned to the &amp;lt;tt&amp;gt;ValidInput&amp;lt;/tt&amp;gt; variable. If &amp;lt;tt&amp;gt;UserInput&amp;lt;/tt&amp;gt; does not contain a valid number, &amp;lt;tt&amp;gt;ValidInput&amp;lt;/tt&amp;gt; is assigned the value &amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt; and an error message is returned.&lt;br /&gt;
&lt;br /&gt;
While test functions exist for checking numbers, date details and arrays in {{OOo}} Basic, a corresponding function for checking Boolean values does not exist. The functionality can, however, be imitated by using the &amp;lt;tt&amp;gt;IsBoolean&amp;lt;/tt&amp;gt; function: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Function IsBoolean(Value As Variant) As Boolean&lt;br /&gt;
  On Error Goto ErrorIsBoolean:&lt;br /&gt;
  Dim Dummy As Boolean&lt;br /&gt;
  Dummy = Value&lt;br /&gt;
  IsBoolean = True&lt;br /&gt;
  On Error Goto 0&lt;br /&gt;
  Exit Sub&lt;br /&gt;
&lt;br /&gt;
  ErrorIsBoolean:&lt;br /&gt;
  IsBoolean = False&lt;br /&gt;
  On Error Goto 0&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;IsBoolean&amp;lt;/tt&amp;gt; function defines an internal &amp;lt;tt&amp;gt;Dummy&amp;lt;/tt&amp;gt; help variable of the Boolean type and tries to assign this to the transferred value. If assignment is successful, the function returns &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;. If it fails, a runtime error is produced, the error handler intercepts the error, and the function returns &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/VBAnote|If a string in {{OOo}} Basic contains a non-numerical value and if this is assigned to a number, {{OOo}} Basic does not produce an error message, but stops converting the string at the first invalid character. This procedure differs from VBA. There, an error is triggered and program implementation terminated if a corresponding assignment is executed.}}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
</feed>