Forum Discussion
Brian_Gupta_115
Nimbostratus
Jan 27, 2005Need a sanity check on a URI parsing rule...
when HTTP_REQUEST {
set my_uri [string tolower [HTTP::uri]]
if { $my_uri contains "/hr" or $my_uri starts_with "hr" } {
pool hrmstest
} ...
Sep 26, 2005
When TCL convers expressions to a boolean value (which is the same for every other language I know), zero is false and non-zero is true.
To answer your question, you could never replace the first with the second because the two statements negate eachother. If usessl = 0, the first statement would be true since usessl equals 0, but the second would be false as the value is zero. If usessl = 1, the first statement would be false since usessl doesn't equal zero, and the second true.
If you are talking about optimizations, my guess would be that the later is slightly faster as the interpreter doesn't need to do the first step of comparing the two values. Although, the improvment would probabaly be so miniscule that it wouldn't warrant worrying about. In this case, I would just worry about readability and maintenace of the rule. Just keep in mind that if you don't explicitly state an equals operation, anything non-zero will equate to true which may not be what you are expecting.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
