New to Rhino scripting, looking for syntax advice


#1

Hi. As of today, I am starting to learn Rhino/Python scripting. I have negligible experience with programming languages, other than some Basic in a distant past (should I mention Algol? :wink: ), and some (very little) experience in creating macro’s for another cad software package.
I am working my way through the Rhino Python Primer, and have read the first pages of the Interactive Python Tutorial at iron python.net.

I have stumbled over the following in conditional loops:
The Primer states that the basic syntax for a ‘while’ loop is

while True
(manipulate variable)
if (condition is met) : break

The Tutorial states as syntax

while (condition is not met)
(manipulate variable)

The latter seems more efficient. Are there any drawbacks to one or the other?


(Steve Baer) #2

I don’t think there are any drawbacks to either approach. Always choose the syntax that is the most “readable” in the context of your script. This way you can figure out what your intention was when you go and look at a script months after you wrote it :smile: