From the course: Grasshopper and Rhino: C# Scripting
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Logical operators
- [Instructor] Earlier, we learned how to compare two values But what if we wanted to compare Booleans to determine the state of different conditions. To do that, we can use logical operators AND, and OR, which allows us to compare two Boolean values. Let's start with having a look at what the AND operator is. AND operators are useful if we 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 operations equal to true. Therefore, the result will be true, as when comparing two Booleans with the AND operator, two trues will result in a true. However, if one of the operations became false, for example, one is greater than five, and the Boolean expression changes to true AND false,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Commenting2m 27s
-
Variables5m 1s
-
Numbers6m 36s
-
Strings5m 37s
-
Collections5m 34s
-
Arrays5m 32s
-
Comparing with operators5m 3s
-
Conditionals3m 30s
-
Logical operators6m 26s
-
Looping with the for loop5m 23s
-
Foreach looping4m 29s
-
Nested loops5m 12s
-
Methods6m 5s
-
Reference vs. value types5m 21s
-
Try and catch4m 14s
-
-
-