wifinigel.MikrotikScripting/scripts/v6/ch8-05-foreach-kv.rsc

9 lines
324 B
Text
Raw Normal View History

2023-01-19 21:27:15 +00:00
# filename: ch8-05-foreach-kv.rsc
# define an array of interface data
:local InterfaceErrors {"WAN"=514; "LAN"=0; "ether3"=0; "ether4"=0; 5};
# use a foreach loop to print out the error value for each interface
:foreach InterfaceName,ErrorCounter in=$InterfaceErrors do={
:put "$InterfaceName errors: $ErrorCounter";
}