Variable Variable... But.. In Mikrotik..??

Hello.. I Have A Problem.. I Can’t Set a Variable Variable in Mikrotik RouterOS..
Variable Variable Is translated as.. The Result of The First Variable is The Name of The Second Variable.. eg with PHP:

$a = “Hello”;

$$a = “What’s Up”; ( This Is The Same To Put [ $Hello = “What’s Up” ]…

But I have not Name of The Second Variable… Need to Use Variable Variable…

And I tried with:

:local a “Hello”;
:local $a “What’s Up”; ( But Not Work )

or:
:put $aa; ( But Not Work )

Help Me… Thanks.. ^^ (My English Is Bad.. Sorry)..

When you initialize the variable you can set it in one shot.
ex:
:local a “Hello”

Then if later in the script you want to change the value of a you use set.
:set a “What’s Up”

Demo (Tested on V3.6)

:local a "Hello"
:log info "a is: $a"
:set a "What's Up"
:log info "a is: $a"

-Louis

I’ve been missing such a feature since 2.8.
There is a crude way of doing it but it does wear on your flash.

:global a “something”
:global b “a”
/ system script run [ / system script add name=assigna source=( ":set b " . $a ) ]
:delay 10ms
:put $b

(Written from memory, YMMV)