Epi Info™ User Guide

Functions and Operators


Operators

There are various types of operators discussed in this appendix. The following types are provided:

  • Arithmetic Operators are used to perform mathematical calculations.
  • Assignment Operators are used to assign a value to a property or variable. Assignment Operators can be numeric, date, system, time, or text.
  • Comparison Operators are used to perform comparisons.
  • Concatenation Operators are used to combine strings.
  • Logical Operators are used to perform logical operations and include AND, OR, or NOT.
  • Boolean Operators include AND, OR, XOR, or NOT and can have one of two values, true or false.

Operator Precedence

If several operations occur in an expression, each part is evaluated and resolved in a predetermined order called Operator Precedence. Parentheses can be used to override the order of precedence and evaluate some parts of an expression before others. Operations within parentheses are always performed before those outside. Within parentheses, however, normal Operator Precedence is maintained.

If expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators next, and logical operators last. Comparison operators all have equal precedence; they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence:

Arithmetic

Comparison

Logical

Negation (-)

Equality (=)

Not

Exponentiation (^)

Inequality (<>)

And

Multiplication and division (*, /)

Less than (<)

Or

Integer division (\)

Greater than (>)

Xor

Modulus arithmetic (Mod)

Less than or equal to (<=)

 

Addition and Subtraction (+, -)

Greater than or equal to (>=)

 

String concatenation (&)

Is

 

If addition and subtraction, multiplication and division, occur together respectively in an expression, each operation is evaluated as it occurs from left to right.

The string concatenation operator (&) is not an arithmetic operator, but in precedence, it does fall after all arithmetic operators and before all comparison operators. The Is operator is an object reference comparison operator. It does not compare objects or their values; it checks only to determine whether two object references refer to the same object.
 

& Ampersand

Description
This operator forces text string concatenation of two expressions. Text concatenation operator connects or concatenates two values to produce a continuous text value.

Syntax
<expression> & <expression>

  • The <expression> represents any valid logical expression.

Whenever an expression is not a string, it is converted to a String subtype. If both expressions are Null, the result is Null. However, if only one expression is Null, that expression is treated as a zero-length string ("") when concatenated with the other expression. Any expression that is Empty is also treated as a zero-length string.

Example

Top