Conditionals are used to make decisions in Python based on a True or False result. In this video, learn how to set up if, else, and elif conditions to control decisions within our scripts.
- [Instructor] As you can see,…the elif statement is just like an if statement…in that we can use it to check…a Boolean or Boolean expression…after an if statement.…When creating Python scripts,…we often need the script to executive differently…based on different conditions,…as we do in Grasshopper.…Think of this like a car at a T-junction.…It can go either left or right.…In Python, we need to be able to tell our scripts…to go either left or right, too,…based on the conditions we set.…To do this, we're going…to learn about conditional statements,…if, else, and elif.…
As you can see, I've already set up…two points in Grasshopper.…Let's add a Python component,…and we'll change the x input to pt1 for point one,…and this will be a point,…and we'll change the y input to pt2,…which will also be a point.…Then, let's plus the first point into pt1…and the second into pt2.…
Then go ahead and open up the Python component.…An if statement is used to check…if a Boolean or Boolean expression is true or false.…The difference between a statement and an expression…
- Python components
- Accessing the Rhino API
- Python programming basics
- Importing modules and libraries
- Grasshopper workflows
- Evaluating surfaces
- Creating and splitting surfaces
- Transforming geometry
- Baking geometry from Python into Rhino
- Adding text objects
- Exporting rendered frames for animation
Skill Level Intermediate
1. Working with Python
2. Python Basics
3. Importing Modules and Libraries
4. Grasshopper Workflows
Next steps3m 53s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.