Forum Discussion
Robert_47833
Altostratus
Jul 21, 2011closing brackets before "else"
Hi,dear Irule
if {[class match $uri starts_with gen3abURLs_SRWD29]} {
if { rand() <0.2 } {
pool cjj-BRX set cjjA_cookie 1
return
}
else {
pool cjj-BROWSE
set cjjB_cookie 1
return
}
}
Hi,in a http request event,if I submit rule like above,it told me undefined procedure :else
but if I changed it to rule like below,it is fine,why should I put else after the closing brackets,how to work around this?
if {[class match $uri starts_with gen3abURLs_SRWD29]} {
if { rand() <0.2 } {
pool cjj-BRX
set cjjA_cookie 1
return
} else {
pool cjj-BROWSE
set cjjB_cookie 1
return
}
}
3 Replies
- hoolio
Cirrostratus
Doctor it hurts when I do this!
Don't do that :)
See unRuleY's post here for details:
http://devcentral-llix.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/8042/showtab/groupforums/Default.aspx
Aaron - Robert_47833
Altostratus
Haha
it is too long
After delete the white space after } which is before "else",it can be submitted - If you don't care to much about readability.. you could leave it out...
"The then and else arguments are optional "noise words" to make the command easier to read."
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/124/iRules-101--02--If-and-Expressions.aspx
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
