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
- [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…
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
-
-
-
-
(Locked)
Commenting2m 27s
-
(Locked)
Variables5m 1s
-
(Locked)
Numbers6m 36s
-
(Locked)
Strings5m 37s
-
(Locked)
Collections5m 34s
-
(Locked)
Arrays5m 32s
-
(Locked)
Comparing with operators5m 3s
-
(Locked)
Conditionals3m 30s
-
(Locked)
Logical operators6m 26s
-
(Locked)
Looping with the for loop5m 23s
-
(Locked)
Foreach looping4m 29s
-
(Locked)
Nested loops5m 12s
-
(Locked)
Methods6m 5s
-
(Locked)
Reference vs. value types5m 21s
-
(Locked)
Try and catch4m 14s
-
(Locked)
-
-