cover image

Conditional (computer programming)

Control flow statement that executes code according to some condition(s) / From Wikipedia, the free encyclopedia

Dear Wikiwand AI, let's keep it short by simply answering these key questions:

Can you list the top facts and stats about Conditional (programming)?

Summarize this article for a 10 years old


In computer science, conditionals (that is, conditional statements, conditional expressions and conditional constructs) are programming language commands for handling decisions. Specifically, conditionals perform different computations or actions depending on whether a programmer-defined Boolean condition evaluates to true or false. In terms of control flow, the decision is always achieved by selectively altering the control flow based on some condition (apart from the case of branch predication).

If-then-else flow diagram
A nested if–then–else flow diagram

Although dynamic dispatch is not usually classified as a conditional construct, it is another way to select between alternatives at runtime.