Coding Helpers – Add Else Statement

August 15th, 2012

The Add Else Statementcode provider performs the operation its name implies – it generates the ‘else’ statement of the current conditional statement. The ‘else’ statement is required when you want to execute a piece of code if a condition is not met. In other words, the ‘else’ is useful when an alternative case is required on the ‘if’ statement.

Now, if the boolean condition is false, the alternative else branch is executed. The code provider may save you a few keystrokes while entering the statement with curly braces in C# and navigate inside it. In Visual Basic, it will generate the corresponding If .. End If code.