From the course: Grasshopper and Rhino: Python Scripting

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Comparing Booleans

Comparing Booleans

From the course: Grasshopper and Rhino: Python Scripting

Start my 1-month free trial

Comparing Booleans

- In an earlier video, we learned how to use comparison operators to compare two different values. But what if we wanted to compare two booleans or boolean expressions to determine if they were true or false? We can with logical operators AND and OR, which allows to two boolean values. This becomes very useful when comparing two or more different comparison operations. So for example, say we had a box in Grasshopper and we wanted to check if the box's surface area was above a certain number, but also if it's volume did not exceed a certain value. We could check these two conditions at once to see if both were true or both were false using logical operators. Let's start with having a look at what the AND operator is. AND operators are useful if we want to check if two 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 true. If we compare these two operations, we're…

Contents