Any idea if this is a bug or just undocumented behavior?
The problem is not RouterOS, but what you expect.
If there is no error, the variable is not defined, so if you don't define it first, it's obvious that it's nothing.
Code:
:put [:local errorName "empty"; :onerror errorName in={:put "errorName is $errorName"; :error "something"} do={:put "errorName is $errorName"}]
result code
errorName is emptyerrorName is somethingtrue
Even the comparison with foreach is ridiculous.
It is obvious that what is used in foreach is already defined at the time of the loop.
And as for the rest, it's ridiculous to try to follow the steps you took if you don't also post the rest of the script.
Statistics: Posted by rextended — Mon Jan 08, 2024 1:11 am