And this comes back to this discussion:
The issue, if one wants to be faithful to what RouterOS accepts as valid... this whole concept that "equals in arguments are options" through a wrench in the scheme. Since no docs EVERY show this "equal-less args" syntax, it a bad idea to start writing scripts this way.
See my existing RouterOS LSP, using /console/inspect request=highlight to determine validity of scripts (on top of how to colorize the script). I'd glossed over this a while back, and just treated syntax-obsolete as a hard error:
But, via testing, scripts > 24K take many seconds to calculate. So the newer approach to use :parse to determine validating (with request=highlight handling colors still). But what this found is that "equal-less args" are accepted, so syntax-obsolete is not actually a "true" error.
For example, taking the above, the following two statements result in the exact same code running on RouterOS:
/system/script; add name beep source { :beep }; run beep
/system/script; add name=beep source={ :beep }; run beep
And if you :put [:parse "..."] the above two lines, both return the same "ParseIL" (:typeof is (code)):
/system/script/;(evl /system/script/addname=beep;source= :beep );(evl /system/script/runnumber=beep)
So not that I unwind this problem, it more then just do/else blocks. These "equal-less args" seem pretty universally accepted...
/ip/firewall/layer7-protocol
add comment "something" regexp 1.1
print
Columns: REGEXP
# REGEXP
;;; something
0 1.1
:put [:typeof [get [find] regexp]]
str
Anyway more interesting scripting factoid. And I agree with @rextended nothing here should be an example of what to do Including use "beep" as a name, even though it's a command, which again is okay in specific context, but generally bad practice. But exactly why some curated set of "rules" that can applied like a "linter" would be so useful... since I do not like the idea that "core" parsing things like my LSP are not faithful to what RouterOS accepts. But at the same time there some generally BAD things that should not be done, even if "accepted".
Basically my own LSP blinded me, for years, to what is in fact "accepted" by RouterOS.
