Community discussions

MikroTik App
 
EtienneO
just joined
Topic Author
Posts: 7
Joined: Wed Apr 11, 2012 6:44 pm

Issue with variables

Thu May 14, 2015 12:23 am

How do I get this to return;
Hello
World

instead of;
1
2

:global Test1 Hello
:global Test2 World

:for n from 1 to 2 do={
:put "$Test$n"
}
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 3108
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Issue with variables

Thu May 14, 2015 1:40 am

{
:global Test1 "Hello"
:global Test2 "World"
:global EvalTestn "";
:global EvalRes ""

 :for n from=1 to=2 do={
  :set EvalTestn [:parse ":global Test$n; :global EvalRes; :set EvalRes \$Test$n"]
  $EvalTestn
  :put ($EvalRes)
 }
}
 
EtienneO
just joined
Topic Author
Posts: 7
Joined: Wed Apr 11, 2012 6:44 pm

Re: Issue with variables

Thu May 14, 2015 3:43 am

Thanks, that works, now I just have to figure out why :-) (It works)