Subtract numbers


#1

How do I subtract 100 from every number in the list above 100

ex.

20
40
60
80
100
120
140
160

Should be

20
40
60
80
100
20
40
60


#2

I’m thinking you’re looking for a modulo function.

There’s a function for that, the thing to remember though, is that when using a mod(100), 100 will become 0, you can circumvent this by detracting one before the mod and adding one after it:


#3

This might be a better solution for your needs?


#4

Could you also use a List.Map with an if code?

Edit: Don’t even need a map node, just an if statement:

I am not sure if you meant only remove 100 as long as it is above 100 (202 becomes 102) or never go over 100. For the former, modulo wouldn’t work but this should.


#5

That is a good question, if everything over 200 should only get 100 subtracted my solution doesn’t work.


#6

Yes everything above 100 should only get 100 subtracted


#7

But what if it goes over 200? Or 300?


#8

If you want any number over 100 to be minus 100 then the following will be the solution.


#9

Great