Community discussions

 
vasilaos
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 91
Joined: Tue Aug 04, 2009 9:50 am

elif statement

Wed Oct 08, 2014 11:52 am

can i use elif statement in mirkotik scripts?
 
User avatar
Deantwo
Member Candidate
Member Candidate
Posts: 290
Joined: Tue Sep 30, 2014 4:07 pm

Re: elif statement

Wed Oct 08, 2014 3:49 pm

Not according to the wiki at least.
http://wiki.mikrotik.com/wiki/Manual:Sc ... _statement

Putting another IF statement inside the ELSE statement seems to be the only way.

No ELSE IF and no SWITCH CASE, it sure makes the scripts look more messy.
Last edited by Deantwo on Wed Oct 08, 2014 4:04 pm, edited 1 time in total.
I wish my FTP was FTL.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5921
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: elif statement

Wed Oct 08, 2014 3:52 pm

else if and switch case are not implemented at the moment
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 1296
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: elif statement

Fri Sep 06, 2019 8:03 am

else if and switch case are not implemented at the moment
So you are working on it? I am waiting with high expectation :)
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 148
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: elif statement

Fri Sep 06, 2019 10:31 am

WorkARound, mutch better then if else if else....
local myFunc do={put $1}
if ($n=1) do={$MyFunc "A"}
if ($n=2) do={$MyFunc "B"}
if ($n=3) do={$MyFunc "C"}
if ($n!=1 & $n!=2 & $n!=3) do={$MyFunc "Other"}
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda

Who is online

Users browsing this forum: No registered users and 10 guests