Arithmetic Operators | Zoho QEngine Help

Arithmetic Operators

In a nutshell
Arithmetic operators perform mathematical operations on numeric values within test scripts. They include addition, subtraction, multiplication, division, and modulus, each applicable to specific data types. The addition operator can also be used to concatenate two or more string values.

Overview

Arithmetic operators are used to perform calculations on numerical values, as well as to concatenate two or more string values. 

The following is a list of Arithmetic Operators:

+ (Addition) : To add numerical values and to concatenate string values. 

Example:

  1. a=5;
  2. b=5;
  3. c=a+b;                    // c= 10
  4. First_Name="John";
  5. Last_Name="Smith";
  6. Name = First_Name + " " + Last_Name;                      // Name = John Smith

- (Subtraction) : To perform subtraction between numerical values.

Example:

  1. a=5;
  2. b=5;
  3. c=a-b;                     // c= 0

* (Multiplication) : To perform multiplication of numerical values.

Example:

  1. a=5;
  2. b=5;
  3. c=a*b;                     // c= 25

/ (Division) : To perform division of numerical values.

Example:

  1. a=5;
  2. b=5;
  3. c=a/b;                     // c= 1

% (Modulus) : To calculate the remainder when a numerical value is divided by another.

Example:

  1. a=5;
  2. b=5;
  3. c=a%b;                   // c= 0

Data types applicable to Arithmetic Operators

  • Number
  • Decimal
  • String (only for 'Addition' operator)
  • Date-Time (only for 'Addition' and 'Subtraction' operators)