Forum Discussion
IRule requires "else" clause?
Loading a SCF config file into new hardware. Getting this warning.
/Common/down4maint_offline_f5_hosted:15: warning: [deprecated usage, use else or elseif][ ]
Being told by support that if statement needs an else clause. Seems pretty silly. Never seen a language that requires an else clause. Makes no sense if the logic is just to continue. Any ideas on the best way to correct this warning?
3 Replies
- Stanislas_Piro2
Cumulonimbus
Can you share here the irule causing this message
- Faruk_AYDIN
Altostratus
If there is a condition like
,then remove theelse {}
or use{}
command instead ofelseif
.else
- youssef1
Cumulonimbus
hello,
You should have an irule like that:
if {$host contains "app1"} { condition } elseif {$host contains "app2"} { condition } else {$host contains "app3"} { condition }
The else should not be conditional, so either use elseif again, or remove the condition in your else.
if {$host contains "app1"} { condition } elseif {$host contains "app2"} { condition } else { condition }
Similar problem: https://devcentral.f5.com/questions/http_request-amp-if-elseif-else-statements
if my answer don't resolve your problem can you give me your irule in order to check it.
Regards
Recent Discussions
Related Content
* 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