Well.. it doesn't work...
Anyone else missing an :unset?[admin@Springbrook] > :unset g1
no such command or directory (unset)
This is 2.9.5 and 2.9.17 it's missing in (I don't know about other versions)
Anyone else missing an :unset?[admin@Springbrook] > :unset g1
no such command or directory (unset)
:local myvar
:foreach i in=1 do={ :set myvar hello }
:put ( [:typeof $myvar] . $myvar )
nil
Manual should be updated then!
http://www.mikrotik.com/testdocs/ros/2. ... ipting.php
Btw, because of wrong documentation i got into this error:
What i thought i was doing:Code: Select all:local myvar :foreach i in=1 do={ :set myvar hello } :put ( [:typeof $myvar] . $myvar ) nil
- Declare a local variable $myvar.
- Update value of myvar to "hello"
What i was actually doing:
- Unsetting (deleting) the variable $myvar.
- Creating a variable $myvar. Because it did not exist when entering the loop, it is defined as local to the loop!
- There is no $myvar when i do the :put, that's why it is "nil".
:local myvar ""
:foreach i in=1 do={ :set myvar hello }
:put ( [:typeof $myvar] . $myvar )
nil
:global a 1
/environment print
:set $a
/environment print