Note: There is a built-in recursion limit to prevent an application crash. " it's possible to ensure the recursion is terminated. Some forms of tail-recursion elimination are supported. This works like the ?: operator from the family of C-like programming languages.Įxamples a=1 b=2 c= a=b ? 4 : 5 // 5Ī=1 b=2 c= a=b ? "a=b" : "a!=b" // "a!=b"Įcho( test ? TrueValue : FalseValue ) // falseĪ1 = test ? TrueValue : FalseValue // Values can be stored in variables, passed as function arguments, and returned as function results. FalseValue: the value to return when test is false.Ī value in OpenSCAD is either a Number (like 42), a Boolean (like true), a String (like "foo"), a Vector (like ), or the Undefined value (undef). See here for boolean and logical operators Do not confuse assignment '=' with equal '=' TrueValue: the value to return when test is true. See here for true or false state of values.
Parameters test: Usually a boolean expression, but can be any value or variable. start - initial value increment or step - amount to increase the value, optional, default = 1 end - stop when next value would be past end examples: for (a =)echo(a) // 3 4 5įor (a =)Ī function that uses a test to determine which of 2 values to return. Note: For range, values are separated by colons rather than commas used in vectors. Parameters As a range (see section on range) Evaluate each value in a range or vector, applying it to the following Action.įor(variable = )