[WEBINAR] Bulletproof: How Today's Business Leaders Stay on Top

Else Statement

Definition - What does Else Statement mean?

In programming languages, an else statement is an alternative statement that is executed if the result of a previous test condition evaluates to false.

Techopedia explains Else Statement

The syntax of the else statement is very similar between different high-level programming languages like PHP, Java, C/C++/C#, Object Pascal, etc. Even early programming languages such as Basic and Fortran have the ability to process an else statement as part of a general syntactical approach to linear programming.

The else statement is an optional statement that is normally used in an "if-else" or "if-else if-else" construction. The way the else statement works is that, if the condition associated with either the "if" or the "else if" control structure is false, program control automatically goes to the else statement, if present.

For example,
 If X is true Then
Do Something
Do Another Thing
End If
 If X = 1 Then
Do Statement 1
Else If X = 2 Then
Do Statement 2
Do Another Thing
End If
Note that, unlike the "if" and "else if" control structure, there is no test condition associated with the else statement.

In Object Pascal, the else statement may also be used in a "case" statement and it serves the same purpose as the "default statement" in the C family of languages such as C/C++, C# and Java.

Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.