Brief review of programming concepts: functions for Booleans

There are many built-in functions that produce Booleans, such as comparisons, including <, >, <=, >=, and so on. Some languages use the same comparison operators for comparing strings as for comparing numbers, and some have different functions for different data typesA type of data, such as a number or a string..

The function not produces true on an input with value false and false on an input with value true. In some languages, non-Boolean values can be given Boolean values of true or false in various situations.

A Boolean expressionAn expression formed of Boolean functions and values. can be formed by joining smaller expressions using or (which results in the value true if at least one smaller expression has value true) or and (which results in the value true if all smaller expressions have the value true). An expression used to make a decision is called a condition.

To determine that the or of a sequence of smaller expressions is true, it suffices to find only one smaller expression that is true. The term short-cut evaluation means that the process of evaluation of smaller expressions stops as soon as one has evaluated to true. That is, working from left to right, evaluation stops as soon as the leftmost true smaller expression (if any) has been found. Similarly, to determine that the and of a sequence of smaller expressions is false, it suffices to find only one smaller expression that is false. In this case, short-cut evaluation results in evaluation stopping as soon as the leftmost false smaller expression (if any) has been found.