Hi, All
i have a basic three data (A) 500, (B) 4250 & © 3.
i want to add number of B(4250) in A (500)= 4750 is Total. then again this process 4750 + B (4250) = 9000 & then again 9000 + B (4250) = 13250. this process is very lengthy.
i have main 3 data A,B & C, C is a repeated number for B.
please suggest me how to solve this problem.
try this
def repeatAddValue(initValue, valueAdd, repeat):
if repeat > 0:
repeat -= 1
sumNum = initValue + valueAdd
return [sumNum] + repeatAddValue(sumNum, valueAdd, repeat)
else:
return []
OUT = repeatAddValue(IN[0], IN[1], IN[2])
3 Likes
Depending on what your doing and how much control/variation you need this could be a option for you.
3 Likes
Thanks Brendan_Cassidy for another options.
1 Like
Using Design Script …
def sumTotal (a,b,c)
{
return = [Imperative]
{
d = [a + b];
for (i in 1..c)
{
f = List.LastItem(d) + b;
d[i] = f;
}
return d;
}
};
sumTotal (500,4250,9);
5 Likes
Realized that you just need a sequence
Using nodes …
Or a line of code …
List.RestOfItems(500..#10..4250);
2 Likes