discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

revalue an array

JW
Joe Weinpert
Fri, Jul 8, 2022 2:33 PM

If I had a multi-dimensional array like this:

arrayA = [[12,12,12],[25,25,25]];

How could I subtract the value of 2 from each value to make another array
like:

arrayB = [[10,10,10],[23,23,23]];

If I had a multi-dimensional array like this: arrayA = [[12,12,12],[25,25,25]]; How could I subtract the value of 2 from each value to make another array like: arrayB = [[10,10,10],[23,23,23]];
NH
nop head
Fri, Jul 8, 2022 2:57 PM

arrayB = [for(item = arrayA) item - [ 2,2,2]];

On Fri, 8 Jul 2022, 15:52 Joe Weinpert, joe.weinpert@gmail.com wrote:

If I had a multi-dimensional array like this:

arrayA = [[12,12,12],[25,25,25]];

How could I subtract the value of 2 from each value to make another array
like:

arrayB = [[10,10,10],[23,23,23]];


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

arrayB = [for(item = arrayA) item - [ 2,2,2]]; On Fri, 8 Jul 2022, 15:52 Joe Weinpert, <joe.weinpert@gmail.com> wrote: > If I had a multi-dimensional array like this: > > arrayA = [[12,12,12],[25,25,25]]; > > > How could I subtract the value of 2 from each value to make another array > like: > > arrayB = [[10,10,10],[23,23,23]]; > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >