Difference between revisions of "Documentation/BASIC Guide/Operators"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Comparison Operators)
Line 16: Line 16:
  
 
{|
 
{|
|+||Addition of numbers and date values, linking of strings
+
|<tt>+</tt>||Addition of numbers and date values, linking of strings
 
|-
 
|-
|<nowiki>-</nowiki>||Subtraction of numbers and date values
+
|<tt>-</tt>||Subtraction of numbers and date values
 
|-
 
|-
|<nowiki>*</nowiki>||Multiplication of numbers
+
|<tt>*</tt>||Multiplication of numbers
 
|-
 
|-
|/||Division of numbers
+
|<tt>/</tt>||Division of numbers
 
|-
 
|-
|\||Division of numbers with a whole number result (rounded)
+
|<tt>\</tt>||Division of numbers with a whole number result (rounded)
 
|-
 
|-
|^||Raising the power of numbers
+
|<tt>^</tt>||Raising the power of numbers
 
|-
 
|-
|MOD||module operation (calculation of the rest of a division)
+
|<tt>MOD</tt>||module operation (calculation of the rest of a division)
 
|}
 
|}
 +
 
== Logical Operators ==
 
== Logical Operators ==
 +
 
Logical operators allow you to link elements according to the rules of Boolean algebra. If the operators are applied to Boolean values, the link provides the result required directly. If used in conjunction with integer and long integer values, the linking is done at the bit level.
 
Logical operators allow you to link elements according to the rules of Boolean algebra. If the operators are applied to Boolean values, the link provides the result required directly. If used in conjunction with integer and long integer values, the linking is done at the bit level.
  
 
{|
 
{|
|AND||And linking
+
|<tt>AND</tt>||And linking
 
|-
 
|-
|OR||Or linking
+
|<tt>OR</tt>||Or linking
 
|-
 
|-
|XOR||Exclusive or linking
+
|<tt>XOR</tt>||Exclusive or linking
 
|-
 
|-
|NOT||Negation
+
|<tt>NOT</tt>||Negation
 
|-
 
|-
|EQV||Equivalent test (both parts <tt>True</tt> or <tt>False</tt>)
+
|<tt>EQV</tt>||Equivalent test (both parts <tt>True</tt> or <tt>False</tt>)
 
|-
 
|-
|IMP||Implication (if the first expression is true, then the second must also be true)
+
|<tt>IMP</tt>||Implication (if the first expression is true, then the second must also be true)
 
|}
 
|}
  
 
== Comparison Operators ==
 
== Comparison Operators ==
 +
 
Comparison operators can be applied to all elementary variable types (numbers, date details, strings, and Boolean values).
 
Comparison operators can be applied to all elementary variable types (numbers, date details, strings, and Boolean values).
  
 
{|
 
{|
|=||Equality of numbers, date values and strings
+
|<tt>=</tt>||Equality of numbers, date values and strings
 
|-
 
|-
|<>||Inequality of numbers, date values and strings
+
|<tt><></tt>||Inequality of numbers, date values and strings
 
|-
 
|-
|>||Greater than check for numbers, date values and strings
+
|<tt>></tt>||Greater than check for numbers, date values and strings
 
|-
 
|-
|>=||Greater than or equal to check for numbers, date values and strings
+
|<tt>>=</tt>||Greater than or equal to check for numbers, date values and strings
 
|-
 
|-
|<||Less than check for numbers, date values and strings
+
|<tt><</tt>||Less than check for numbers, date values and strings
 
|-
 
|-
|<=||Less than or equal to check for numbers, date values and strings
+
|<tt><=</tt>||Less than or equal to check for numbers, date values and strings
 
|}
 
|}
  

Revision as of 11:58, 26 September 2007


Operators

Apache OpenOffice Basic understands common mathematical, logical, and comparison operators.

Mathematical Operators

Mathematical operators can be applied to all numbers types, whereas the + operator can also be used to link strings.

+ Addition of numbers and date values, linking of strings
- Subtraction of numbers and date values
* Multiplication of numbers
/ Division of numbers
\ Division of numbers with a whole number result (rounded)
^ Raising the power of numbers
MOD module operation (calculation of the rest of a division)

Logical Operators

Logical operators allow you to link elements according to the rules of Boolean algebra. If the operators are applied to Boolean values, the link provides the result required directly. If used in conjunction with integer and long integer values, the linking is done at the bit level.

AND And linking
OR Or linking
XOR Exclusive or linking
NOT Negation
EQV Equivalent test (both parts True or False)
IMP Implication (if the first expression is true, then the second must also be true)

Comparison Operators

Comparison operators can be applied to all elementary variable types (numbers, date details, strings, and Boolean values).

= Equality of numbers, date values and strings
<> Inequality of numbers, date values and strings
> Greater than check for numbers, date values and strings
>= Greater than or equal to check for numbers, date values and strings
< Less than check for numbers, date values and strings
<= Less than or equal to check for numbers, date values and strings

Template:Documentation/Note


Content on this page is licensed under the Public Documentation License (PDL).
Personal tools