Conditional (computer programming)
[File:If-Then-Else-diagram.svg.png[|thumb|If Then Else diagram in UML.]]In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.
Apart from the case of branch predication, this is always achieved by selectively altering the control flow based on some condition.
Description
In imperative programming languages, the term "conditional statement" is usually used, whereas in functional programming, the terms "conditional expression" or "conditional construct" are preferred, because these terms all have distinct meanings.
Although dynamic dispatch is not usually classified as a conditional construct, it is another way to select between alternatives at runtime.
See also
- Branch (computer science)
- Conditional compilation
- Conditional move
- Dynamic dispatch for another way to make execution choices
- Imperative programming language
- McCarthy Formalism for history and historical references
- Named condition
- Test (Unix)
- Yoda conditions