From the course: Grasshopper and Rhino: C# Scripting

Unlock the full course today

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

Nested loops

Nested loops

From the course: Grasshopper and Rhino: C# Scripting

Start my 1-month free trial

Nested loops

- [Instructor] Now that we have a good grip of how loops work, let's take a look at nesting loops. This is essentially inserting one loop into another, which can often be used in creating geometry or accessing nested data. In a previous lesson, we learnt how to create a row of spheres using the for loop But what if we wanted to create a grid of points to create a facade or column set out. A simple way to do this is with nested loops. Nested loops work how they sound by nesting or placing a loop within another loop. So we will set up a loop like we did previously, looping a number of times, in this case five, but this time for each loop we'll create another loop, which will execute for the same number of times. Within that inner loop is where we'll create a cylinder that will gradually get smaller. In a new script, go ahead and place a new C# component. and let's open it up. To start, let's create a new list which will…

Contents