Hello everybody,
I want to make script where condition are in array
example:
array (10;20;30)
if (one of condition are in array) do={something}
thanks in advance
Hello everybody,
I want to make script where condition are in array
example:
array (10;20;30)
if (one of condition are in array) do={something}
thanks in advance
Use “find” ( https://wiki.mikrotik.com/wiki/Manual:Scripting#Operators )
One notice - if no element found find returns no value (i.e. value of type nil)
:local arr {10;20;30;40}
:put "Array is:"
:put $arr
:local values {10;15;30;45}
:foreach v in=$values do={
:local p [:find $arr $v]
:if ([:type $p]="nil") do={
:put "$v is not in array"
} else={
:put "$v is in array"
}
}