The for loop is ideal when looping over a set amount of items. The while loop works best when looping over an unknown set of items. In this video, explore how the two relate and learn how to use both.
- [Instructor] The while loop is…the second of two loops available…to us is Python.…Unlike the for loop the while loop…will loop until a condition is false.…Think of a while loop like a set of traffic lights.…While the light is green traffic…will continue to drive through…until a condition tells the traffic to stop.…Such as a red light.…This is how a while loop works.…It will continue to execute a set of instructions…until a condition tells it to stop.…Let's say for example, we had a variable…named Var which equaled zero.…
For a while loop we need a condition.…Say Var is less than five.…This is the condition that will tell…the loop to stop.…While Var is less than five the while loop…will run executing whatever is written…within the loop.…Therefore, the Var variable needs to increment.…Meaning, it needs to increase with each loop…or the loop will continue to execute with no end…causing Grasshopper to crash at the very least.…So for example, if the variable started at zero…and we incremented it by one for each loop…
- 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.