Community discussions

MikroTik App
 
naven
just joined
Topic Author
Posts: 6
Joined: Sat Jan 18, 2014 3:04 pm
Contact:

How do I check if a variable is empty?

Mon Nov 03, 2014 2:51 pm

I'm writing a simple script and i'm a little stuck. I need to check if a variable is empty. How can I do that?
 
User avatar
skot
Long time Member
Long time Member
Posts: 584
Joined: Wed Nov 30, 2011 3:05 am

Re: How do I check if a variable is empty?

Tue Nov 04, 2014 1:53 am

You could check variable length, something like:
:if ([:len $var] = 0) do={
  ... your code here
}
 
naven
just joined
Topic Author
Posts: 6
Joined: Sat Jan 18, 2014 3:04 pm
Contact:

Re: How do I check if a variable is empty?

Sat Nov 08, 2014 6:34 pm

It seems to be working. Unfortunately it's not exactly doing what I meant it to do. The same thing applies to my previous code...
Thanks anyway.

Who is online

Users browsing this forum: No registered users and 30 guests