[OpenSCAD] Incrementing a variable doesn't work as expected.

nigeljohnson73 nigel at nigeljohnson.net
Wed Apr 1 06:10:15 EDT 2015


And there's the answer - brackets :)

function cpos(s, n) = (n == 0) ? (0) : ( cpos(s,n-1) + ((s[n-1]==".") ? 2 :
4 ));

Now works as expected.

Thanks guys!!!
N.



--
View this message in context: http://forum.openscad.org/Incrementing-a-variable-doesn-t-work-as-expected-tp12271p12284.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list