Input list doesn't update

In next image, when changing input A I would expect that input listA is updated automatically to the input. Now it remembers the last output, and so keeps adding A to the output. Is there a way to force design script to refresh listA?

@Yna_Db Thanks. But what if there is a loop in a loop like in attached figure?

Think I found it. See attached figure.

X doesn’t seem to be necessary here and List.Empty makes apparently the else option useless

It is a simplified example, to try to understand the mechanism. It is still not clear to me. Is it that an input variable can not be changed? Or is it like the documentation says: “There is a special case for self‐redefinition, i.e., a variable depends on itself. For example, “ a = a +1 ”. This kind of self‐redefinition will not remove previously established associativity between “a” and other variables. Besides, the change of “ a ” will only update its dependents, not “ a ” itself.”

No you’re getting confused between associative and imperative DesignScript syntax. Your code block has redundancy (i.e. pointless steps) and there appears to be a bug with your List B input (it shouldn’t have any input to the code block as you assign an object to it, but it’s there?) and it might be worth reporting on the Dynamo GitHub. All of the above isn’t helping you’re learning curve! If you check the DS documentation on it explains how to write functions which should help your comprehension.

@Thomas_Mahon Yes I noticed the bug, but it doesn’t harm the solution. Will report it though.
But the pointless steps I don’t see. The goal is to add the values of a listA a number A times to itself. If A =1 then it should be itself. Of course this could be solved in a single loop by multiplication of listA[y] by A. But my real problem needs two loops through different lists. Only try to get the right syntax here.
In the ‘else statement’ I add a value of listA to the value of listB at the same position. But if listB at that position is null, the result is always null (oops…, should check listA also for null values!). So I have to check for that and in that case set the value of listB to that of listA. In the example this is the case for only the first y-loop. If I don’t set listB to empty, it will keep adding values when I change the input. I could set it to listA, but then you always start adding and listB can never be the same as listA (a loop 0…0 runs once). Now if input A is 1 listB is the same as listA.
But you might be right that studying design script functions (which I skipped indeed) could give better solutions. I will do that. Thanks.