The == operator and the == operator perform the same operation when used in a Boolean expression

Addition (+)

Description
This operator provides the sums of two numbers. Basic arithmetic operator used for addition; the result of an arithmetic operator is usually a numeric value.

Syntax
[expression1] <operator> [expression2]

Comments
Although the + operator can be used to concatenate two character strings, the & operator should be used for concatenation to eliminate ambiguity and provide self-documenting code. If + operator is used, there may be no way to determine whether addition or string concatenation will occur. The underlying subtype of the expressions determines the behavior of the + operator in the following way:

If

Then

Both expressions are numeric Add
Both expressions are strings Concatenate
One expression is numeric and the other is a string Add

If one or both expressions are Null expressions, the result is Null. If both expressions are Empty, the result is an integer subtype. However, if only one expression is Empty, the other expression is returned unchanged as a result.

Example

READ {.ProjectsSampleSample.prj}:Oswego 
DEFINE Newvar NUMERIC 
ASSIGN Newvar = Age + 5
LIST Age Newvar

ARITHMETIC

Description
These basic arithmetic operators can be used in combination with other commands. The result is a numeric value.

Syntax
[Expression] <Operator> [Expression]

  • [Expression] is a numeric value or a variable containing data in numeric format.

Comments
The results are expressed in numeric format. The basic mathematical operators that can be used in Epi Info are as follows:

  • Addition + Basic arithmetic operator used for addition; the result of an arithmetic operator is usually a numeric value (i.e., EX. 3 + 3).
  • Subtraction – (Used for subtraction or negation.) Basic arithmetic operator used for subtraction or negation; the result of an arithmetic operator is usually a numeric value (i.e., EX. 3 – 1).
  • Multiplication * (Asterisk) Basic arithmetic operator used for multiplication; the result of an arithmetic operator is usually a numeric value.
  • Division / Basic arithmetic operator used for division; the result of an arithmetic operator is usually a numeric value.
  • Exponentiation ^
  • Modulus or Remainder MOD

Arithmetic operators are shown in descending order of precedence. Parentheses can be used to control the order in which operators are evaluated. The default order, however, frequently achieves the correct result.

While it is possible to do date math with dates considered as a number of days (e.g., IncubationDays = SymptomDateTime – ExposureDateTime), the behavior of the database services underlying Epi Info makes it more efficient to use time interval functions (e.g., IncubationDays = MINUTES(ExposureDateTime, Symptom DateTime)/[24*60]). For doing date math, the following rules apply:

Date + Date produces Date
Date – Date produces Days
Date * Date not permitted
Date / Date not permitted
Date ^ Date not permitted
Date + Number produces Date
Number + Date produces Number
The last two rules apply as well to other math operations: -, *, /, ^
The “zero day” for date math is December 30, 1899.

Example

READ {.ProjectsSampleSample.prj}:Surveillance  
DEFINE var1 NUMERIC 
ASSIGN var1=1250 MOD 100 
DEFINE var2 NUMERIC 
ASSIGN var2=1+1 
DEFINE var3 NUMERIC 
ASSIGN var3=2-1 
DEFINE var4 NUMERIC 
ASSIGN var4=1*1 
DEFINE var5 NUMERIC 
ASSIGN var5=8/4 
DEFINE var6 NUMERIC 
ASSIGN var6=5^2 
LIST var1 var2 var3 var4 var5 var6

Comparisons

Description
These comparison operators can be used in If, Then, and Select statements in Check Code and Analysis programs. Yes/No variables can only be tested for equality against other Yes/No constants (+), (-), and (.).

Operator

Description

= Equal to Comparison operator used for equal to; the result of comparison operators is usually a logical value, either True or False. EX. A1 = B1.
> Greater than comparison operator. Compares a value greater than another value; the result of comparison operators is usually a logical value, either True or False. Comparison operator used for comparing a value greater than another value; the result of comparison operators is usually a logical value, either True or False. EX. A1 > B1.
< Less than comparison operator. Compares a value less than another value; the result of comparison operators is usually a logical value, either True or False. Comparison operator used for comparing a value less than another value; the result of comparison operators is usually a logical value, either True or False. EX. A1<B1.
>= Greater than or equal to.
<= Less than or equal to.
<> Not equal to.
LIKE Left side variable matches right side pattern; in pattern, ’*’ matches any number of characters, ’?’ matches any one character.

Syntax
[Expression] <operator> [Expression]
[Expression] is any valid expression.

Comments
Comparison operators are executed from left to right. There is no hierarchy of comparison operators. The <> operator can be used only with numeric variables. For non-numeric variables, use NOT.

Example

READ {.ProjectsSampleSample.prj}:Surveillance  
SELECT Age>20 LIST Age Disease 
READ {.ProjectsSampleSample.prj}:Surveillance  
SELECT Age<45 LIST Age Disease 
READ {.ProjectsSampleSample.prj}:Surveillance 
SELECT Age>=38 LIST Age Disease 
READ {.ProjectsSampleSample.prj}:Surveillance  
SELECT Age<>77 LIST Age Disease 

Which operator is used when both the statements are true?

&& is the logical and operator. It returns TRUE if both of the arguments evaluate to TRUE.

What is the difference between an if statement an IF ELSE statement and an IF ELSE IF statement quizlet?

. In an if/else if statement, the conditions are tested until one is found to be true. The conditionally executed statement(s) are executed and the program exits the if/else if statement. In a series of if statements, all of the if statements execute and test their conditions because they are not connected.

Which operator result in true if both the operands are true?

The && (logical AND) operator indicates whether both operands are true. If both operands have nonzero values, the result has the value 1 .

Can an if statement test expressions other than relational expressions?

Can an if statement test expressions other than relational expressions? Yes - The if statement tests the expressions that returns the numeric value or Boolean value; that is True (or 1) or False (or 0).