The official help https://wiki.mikrotik.com/wiki/Manual:S ... ith_Arrays is not very helpful when it comes to understanding and using arrays
There needs to be more examples and theory explanation
What i'm trying to do is something like this
:global SetInterfaces {"ether1", "ether2", "ether5"}
:foreach i in=$SetInterfaces do={/interface set [find where name=$i] comment="Mark This Interface"}
I imagine that command should run 3 times, setting each interface specified in the array with the comment of "Mark This Interface" but it doesn't work because when I change the script to this
:global SetInterfaces {"ether1", "ether2", "ether5"}
:foreach i in=$SetInterfaces do={:put $i}
The output is "ether1;ether2;ether5" implying the command runs only once and outputs every array value at the same time
Instead I expect the output should have been
ether1
ether2
ether5
so that it runs 3 times
As a result the first example fails because its only running once and looking for an interface called "ether1;ether2;ether5" instead of running 3 times looking for "ether1" then "ether2" then "ether5"
So my question is how do I achieve the desired result? Keep in mind the length of the array is dynamic, it might only have 3 interfaces now but its not always going to be the case, sometimes only 1 interface, sometimes 20 interfaces or anything in between