mapping values

PaulS:

needs to be declared only the first time, will static also solve this problem?

That is what static is meant for. Declaring variables that you will expressly reset every pass through loop as static doesn't really make sense.

Thank you PaulS, you helped me excessively.