Community discussions

 
el berto
Member Candidate
Member Candidate
Topic Author
Posts: 197
Joined: Wed Sep 26, 2007 10:53 am

How update/increase a variable?

Fri Apr 30, 2010 4:54 pm

Sorry, I can't find similar topic.

I have a variable
:global a 5;
and I would like increase/update by defined step (x example 5).
I used
:global a ($a + 2);
but now I have a = 2 and not 7.
How can I do?
 
fewi
Forum Guru
Forum Guru
Posts: 7734
Joined: Tue Aug 11, 2009 3:19 am

Re: How update/increase a variable?

Fri Apr 30, 2010 5:30 pm

[admin@MikroTik] > :local a 5; :set a ($a + 2); :put $a;
7
Use :global to bring the variable in initially, but then use :set to change its value. :global and :local just declare values, and set initial values.

Who is online

Users browsing this forum: MSN [Bot] and 14 guests