Create a Code Block with "Math" codes and "If"

Hi Guys,

I have two problems to solve and I will ask any help or advise.
The first one (You can see in the image).
A don’t know how to create (I tried) a code block with the command if and math…=/
The other problem is a little complex.
I want to create a code block like “loop-while”(Bug for me), I want to calculate the elements in one list if one element does not meet the requirements (< 3), I want a loop to try other elements in another list to reach the goal (<3)

Can someone give me an advice?

Sorry about my English…=)

i think this is the kind of formula you want to be using for this.
this was made in python so you will need to translate it to designscript.
for basic while and if loops please refer to websites like stackoverflow etc.

formula = (IN[0])
out = []
for i in formula:
while i < 3:
out.append(2)
else:
out.append(i)

OUT = out

kind regards,

Timo

1 Like