Evaluation Order of Multiple Operators

This section describes the precedence of operators.

When an expression has multiple operations with multiple operators, the order of evaluation of each operation is based on the following rules:

1. Operators of higher precedences are evaluated before operators of lower precedences.

2. Operators of on the left side are evaluated before operators on the right side.

Examples of expression evaluation orders:

1. "*" has a higher precedence than "+":

# "2 * 3" is evaluated first, because "*" has a higher precedence
1 + 2 * 3;

# The above expression is an alias of:
integer.add(1,integer.multiply(2,3)); 

2. "+" and "-" have the same precedence:

# "1 + 2" is evaluated first, because "+" is on the left side 
# and "+" and "-" have the same precedence
1 + 2 - 3; 

# The above expression is an alias of:
integer.subtract(integer.add(1,2),3);

The above examples assume that we are using the commonly accepted precedence rules of arithmetic operations.

The exact list of operators and their precedences will be provided when we introduce individual data types.

Last update: 2017.

Table of Contents

 About This Book

 Introduction of H Language

 Syntax

 Data Types

 Variables

Expressions

 What Is an Expression

 Operations Are Aliases of Function Calls

Evaluation Order of Multiple Operators

 Sub-Expressions

 Statements

 "boolean" Data Type

 "integer" Data Type

 "string" Data Type

 "real" Data Type

 "array" Data Type

 Source Code Packages

 Classes and Objects

 Object Oriented Programming

 Inheritance - Object Attachments

 Encapsulation - Private Members

 References

 PDF Printing Version