I have two list variables @{vinrange}
and @{sg}
both with same dimensions of 4
I want to print into the LOG
using the scalar ${VAR1}
for each value from the list variable @{vinrange}
and print using a second scalar ${VAR2}
for each value from the list variable @{sg}
I have to assign both of them into the same loop, the ${VAR1}[1]
has worked for the @{vinrange}
, however, I don't know how to do for the second list variable @{sg}
.
There is a FOR
construct version precisely for this situation - to iterate over two lists simultaneously - that is with IN ZIP
, link to the documentation .
It expects two or more iterables (like lists), and on every iteration returns the values of each at the same index.
Note that it will stop at the shorter one's last element (e.g. if their lengths are different, it won't raise an exception, nor it will fully exhaust the longer list). So for your case:
FOR ${vinrange_element} ${sg element} IN ZIP ${vinrange} ${sg}
Log ${vinrange element}
Log ${sg element}
END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With