Flowgorithm Logical Operators
In this tutorial, we will learn about Flowgorithm logical operators. Logical operators work on boolean operands.
In Flowgorithm, logical operators are used to combine or negate boolean expressions. They are essential in decision-making and looping constructs where conditions need to be evaluated. They allow us to combine multiple conditions into a single boolean result and multiple conditional expressions.
What is a logical operator?
The Flowgorithm Logical operators are as follows:
- Logical AND
- Logical OR
- Logical NOT
Example
Sample flowchart to demo logical operators:
&& operator returns true if both conditions are true.
(x > 5) && (y < 10)
This evaluates to true if x is greater than 5 and y is less than 10.
|| operator returns true if at least one of the conditions is true.
(x > 5) || (y < 10)
This evaluates to true if either x is greater than 5 or y is less than 10.
! operator reverses the truth value of a condition.
!(x > 5)
This evaluates to true if x is not greater than 5.