Scripting in GH Part 06
Course or Collection:
Software:
Tag:
Video Duration:
8 minutes
In this tutorial we demonstrate the while loop by recreating the series component. The key thing to remember when you use a while loop is that you are responsible for creating the initialization and iteration clauses. I guess technically, no matter what kind of loop you create, you are responsible for these things. However, with the while loop it is very easy to forget these. It is also surprisingly easy to forget to make sure your statements meet your condidtion clause and actually end the loop--avoiding the dreaded infinite loop.
List<int> numbers = new List<int>(); int i = 0; while (i < count) { numbers.Add((i*step) + start); i++; } A = numbers;
Want to Contribute?
Want to be an author? Drop us a line here we'd love to have you.
Already have a video you'd like to post? Send us a link and we'll get you going.
:)
Comments
bayupu replied on Permalink
Zach Downey replied on Permalink
HCFU.rocks replied on Permalink