Scripting in GH Part 08

Software: 
Tag: 
Video Duration: 
8 minutes
Author: 
Zach Downey

In this lesson, we cover control flow in your scripts.  We introduce the if-else clause and also touch on the modulo % operator.  I also quickly cover strings, which somehow I've been able to avoid up to now--purely by accident.  

if (x == true) {
    A = "It's True!";
} else {
    A = "It's False";
}
List<Point3d> pts = new List<Point3d>();
 
for (int i = 0; i < 100; i++) {
    if (i%3 == 0 || i %5 == 0) {
        Point3d ptTemp = new Point3d(i, 0, 0);
        pts.Add(ptTemp);
    }
}
A = pts;

Rating

Please rate this tutorial below. Thanks.

5
Average: 5 (4 votes)

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.

:)