This rule is Obsolete | |
Synopsis: | Finish every if-else-if statement with an else part |
Language: | C# |
Severity Level: | 5 |
Category: | Control flow |
Description: |
The intention of this rule, which applies to else-if constructs, is the same as in [6@105]. Consider the following example.
void Foo(string answer) { if ("no" == answer) { Console.WriteLine("You answered with No"); } else if ("yes" == answer) { Console.WriteLine("You answered with Yes"); } else { // This block is required, even though you might not care of any other // answers than "yes" and "no". } |