← Back to context

Comment by lucasoshiro

8 days ago

Actually, not much except the curly braces + semicolons, which makes it look like C, C++, Java and many others.

OpenSCAD is functional/declarative, so you can't change the state of a variable, functions don't have colateral effects, lists are immutable, and so on.

We also don't have for, while or if-else in the way we have in other languages. A for loop in OpenSCAD is only a way to repeat objects (= 3D objects, not POO objects), if-else are like a ternary operator for objects, the objects aren't values, and so on.

OpenSCAD has also some built-in less common features. One highlight for me are native vector and matrix multiplication, and other is the list index based on the name of the axis (list.x means list[0], list.y means list[1] and list.z means list[2]). But it lacks string and list operations, which would demand some FP-fu to write your own functions to manipulate them, just like the author did.

If you speak Portuguese, I gave a course last year about OpenSCAD. The slides are available here: https://lucasoshiro.github.io/posts-en/2024-03-24-openscad/