Range Over Built in OpenSCAD
Here we use range
to sum the numbers in a slice. Arrays work like this too.
range
on arrays and slices provides both the index and value for each entry. Sometimes we actually want the indexes.
range
on map iterates over key/value pairs.
range
can also iterate over just the keys of a map.
range
on strings iterates over Unicode code points. The first value is the starting byte index of the rune
and the second the rune
itself.
Running this OpenSCAD script will produce the following output in the console:
Next example: Pointers.