 Hermit's Free Library  Database

Covers operation symbols used for math, string manipulation, logic, and comparison expressions. Includes order of precedence and truth table.

# Truth Table

The following Truth Table provides all the rules needed to evaluate logical expressions.

 A B A AND B A OR B NOT A T T T T F F T F T T T F F T F F F F F T

The AND and OR columns of a truth table can be summarized as follows:

• "A .AND. B" is true only if both A and B are true.
• "A .AND. B" is false if either A or B is false.
• "A .OR. B" is true if either A or B is true.
• "A .OR. B" is false only if both A and B are false.

## Logical operator symbols

Logical, or Boolean operators are used in logical (Boolean) expressions. (Example: (A .AND. B .OR. C) ).

 Symbol Meaning NOT Logical NOT AND Logical AND OR Logical OR

Just as in mathematical expressions, there is a specific order of precedence for evaluating logical expressions which have more than two operators. Expressions inside of parentheses are evaluated first, and the logical operators are evaluated in the following order:

1. .NOT.
2. .AND.
3. .OR.

Example: the parentheses in the following example make the two statements logically different:

• A .AND. B .OR. C
• A .AND. (B .OR. C)

# Math, Comparison, and Logical Operator Symbols

## Math Operator Symbols

Math operator symbols indicate what operations are to be performed when evaluating an arithmetic expression such as X / Y * (A + B * A).

### Symbols

 Symbol Operation ^ Exponentiation * Multiplication / Division + Addition - Subtraction

### Order of Precedence

When evaluating a mathematical or logical expression, expressions contained within parenthesis are always evaluated first. The order of precedence for the remaining math operators is from left to right in the following order:

1. Exponentiation
2. Multiplication and Division

The following phrase is useful to remember the order of precedence for the mathematical operators. Just be sure to realize that multiplication does not come before division (they are equal and performed left to right unless there are parenthesis) and addition does not come before subtraction (they are equal and performed left to right unless there are parenthesis).

Please Excuse My Dear Aunt Sally.

## String operation symbols

String operation symbols indicate how two or more character strings are combined, an operation known as concatenation.

 Symbol Operation + Concatenate two character strings - Concatenate two character strings (trailing spaces of 1st string are appended to end of resulting string)

Example (_'s represent blank spaces)

• "Hello____"+"There."="Hello____There."
• "Hello____"-"There."="HelloThere.____"

## Comparison operator symbols

Comparison operators are used to make comparisons between math, character, or date expressions. They result in the logical values True or False, as used with boolean logic.

 Symbol Meaning < Less than > Greater than = Equal to <> or # Not equal to <= Less than or equal to >= Greater than or equal to \$ Substring comparison Example, if A and B are character strings, A\$B returns a logical True if A is either identical to B or contained within B.