From the course: Dynamo for Revit: Python Scripting

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Logical operators

Logical operators

- [Instructor] While comparison operators are good at comparing values, logical operators allow us to compare booleans. This becomes very useful when comparing two or more different value comparisons. So, for example, say we had a sphere in Dynamo, and we wanted to check if the sphere's radius was above a certain number, but also positioned above a particular Z-value, we could check both of these conditions at once to see if they were either both true or both false using logical operators. So let's start by having a look at the AND operator. AND operators are useful if you want to check if two boolean operations, or booleans, are true. Say, for example, we had two operations. Two is greater than one, and one is less than five. As we have learned, both of these operations will equal to true. If we compare these two operations, we're essentially comparing true AND true, as both are equal to true, and therefore the result will equal true, as when comparing two booleans with the AND…

Contents