Forum Discussion

BaltoStar_12467's avatar
Oct 02, 2015

BIG-IP : tcl boolean logic for string comparisons

F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi

What is correct syntax for boolean operations around string comparisons ?

set a "a"
set b "b"
set result 0
if { { $a eq "a" } && { $b eq "b" } } {
  set result 1
}

This compiles but throws a runtime exception :

expected boolean value but got " $a eq "a" " while executing "if { { $a eq "a" } && { $b eq "b" } ...

  • Hello,

    Your logic is correct, however, the use of double curly brackets does not seem right.

    Try the following as your conditional statement:

    if { ( $a eq "a" ) && ( $b eq "b" ) } {