MikroTik scripting: How to make arrays and use for loops?


How do I do this in the MT scripting language? I am putting in bash in to describe what I want to know how to do. Please ignore that this example doesn’t make any sense.

array=( foo bar baz )
:for i from "${array(@)}" do={
/ip dns static add address=2.2.2.2 name=$i.domain.com ttl=1w type=A
}

The desired result would be:

/ip dns static add address=2.2.2.2 name=foo.domain.com ttl=1w type=A
/ip dns static add address=2.2.2.2 name=bar.domain.com ttl=1w type=A
/ip dns static add address=2.2.2.2 name=baz.domain.com ttl=1w type=A

So how do I..?

  1. Make the array
  2. Use the array in a for loop
  3. Use the resultant variables as a substring (is this even possible?)