Skip to content

Comparison Operators

Hongtu supports the following comparison operators:

  • Equal
  • Not Equal
  • Greater Than
  • Greater Than or Equal
  • Less Than
  • Less Than or Equal
  • Is Null
  • Is Not Null

Add Node

Right-Click Anywhere on canvas, select Operator/Comparison

Equality Operator

The Equal and Not Equal operators are used to compare two values. When two values are equal, the Equal operator will return true, otherwise false.

When types of the two input are different, they will be converted to the same type before comparison, similar like Javascript's == and != operators, which is Losely Equal. So for example:

1 == "1" will return true.

Relational Operator

The Greater Than, Greater Than or Equal, Less Than, Less Than or Equal operators are used to compare two values. They follow Javascript comparison rules as well. For numbers, they will compare the numeric value, for strings, they will compare the lexicographical order.

In the example above, we try to compare c with b, c is greater than b, so the Greater Than operator will return true.

INFO

We added two String Data Source nodes, they are literal constants, we will discuss them later.

Null Comparison

The Is Null and Is Not Null operators are used to compare whether a value is null or not. In Hongtu, variables with a data type of Object can be null.

INFO

Variables will be discussed later.