Documentation

Comparison

comparison

The comparison operator has 6 different comparisons it can make between two values.

They are quite self-explanatory. The block will succeed if the two values provided satisfy the condition, which is one of:

  • "is the same value as"
  • "is a different value from"
  • "is less than"
  • "is greater than"
  • "is less than or the same value as"
  • "is greater than or the same value as"

This will only work if the values are ordered, like numbers, or dates.

It compares the values, but it does not know whether the values are coming from the same source.

If you want to know whether objects referred to by two variables are the same object (they are "identical"), then you don't want to compare their values, you want to check their identities. That is done using the object equality or object disequality blocks.

Comparing Dates

Note also that for dates, the Date Comparison block is also available, and uses more friendly language, like "before" and "after".

date comparison

Numerical Constraints

A comparison serves to ask whether two values satisfy a requirement. But Blawx cannot use a comparison for reasoning. For example, if you say that people at least 16 must pay taxes, and people at least 18 may vote, and you ask Blawx who must pay taxes and may not vote, it won't know, because it cannot logically combine the comparisons.

For that purpose, you should use numerical constraints. In that case, the "16 or older" and "less than 18" can be combined into a single answer of "people who are 16 or older, but less than 18".