Community discussions

MikroTik App
 
User avatar
savagedavid
Trainer
Trainer
Topic Author
Posts: 320
Joined: Thu Aug 25, 2005 12:58 pm
Location: Cape Town, South Africa
Contact:

Compare 2 truth values

Tue Jul 18, 2006 11:07 am

I am trying to write an IF-THEN statement to compare 2 values which are either tru or false. The statement is of the form:

IF (condition = true AND condition = true) THEN do action

An example I tried is :

:if ([/ping 10.0.0.254 count=1] & [/ping 10.0.0.253 count=1] = 1) do {:put "Both Gateways reachable"}

The script returns an error saying

Cannot compute logical AND of integer and truth values.

How can I compare 2 truth values?

Thanks
David
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Mon Jul 24, 2006 10:22 am

:if ([/ping 10.0.0.254 count=1]=1 && [/ping 10.0.0.253 count=1]=1) do {:put "Both Gateways reachable"}
Eugene
 
User avatar
savagedavid
Trainer
Trainer
Topic Author
Posts: 320
Joined: Thu Aug 25, 2005 12:58 pm
Location: Cape Town, South Africa
Contact:

Mon Jul 24, 2006 11:48 am

Thanks - I initially had the right idea - just my formatting of the statement was wrong. It is working properly now.

Who is online

Users browsing this forum: zosoft and 18 guests