Is there “continue” statement in mikrotik scripting?
example:
:for i from=1 to=5 do={
:if($i=3) do={continue}
:log info $i
}
Output:
1
2
4
5
Is there “continue” statement in mikrotik scripting?
example:
:for i from=1 to=5 do={
:if($i=3) do={continue}
:log info $i
}
Output:
1
2
4
5
:continue command was added in 7.22 alpha, if anyone wants to try: https://mt.lv/nightly-build
Wow, it's been 13 years. ![]()
Now lets wait for :break another 13yrs ![]()
:break was also added together with :exit in 7.22, no need to wait ![]()
Seems like powerful commands.
Excellent...
While we wait for a "stable" or "long-term" release (perhaps the prophesied 7.23.5) we can do this:
:for i from=1 to=5 do={
:if ($i!=3) do={:put $i}
}
For sure, considering time passed from our necroposting who knows if OP will read this ![]()
Yes, of course, but the message was addressed to everyone, not just the OP. ![]()
IMO, it's not necroposting to "close" a feature request, when OP wasn't resolved. In fact, not opening a new topic I'd say is preferable since the 13 year timeframe is an interesting data point.
I agree, new topic with link reference to this topic may be just a additional forum topics bloat.
Don't worry when this makes it to testing channel, someone is still going ask what does 'console - add :continue to scripting' mean?. It seems searching is not everyone's skill.
Now if only we could get some more functional-style :match and/or :switch/:case to better organize things... but at least continue/break will allow similar pattern matching.
Definitely will simplify and reduce number of lines in script code