Control flow

looploopscontrol structurecontrol structuresprogram flowcontrolloopingflow controlcontrol-flowflow of control
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.wikipedia
424 Related Articles

Declarative programming

declarativedeclarative languagedeclarative programming language
The emphasis on explicit control flow distinguishes an imperative programming language from a declarative programming language.
In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.

Programming language

programming languageslanguagedialect
Within an imperative programming language, a control flow statement is a statement, the execution of which results in a choice being made as to which of two or more paths to follow.
For example, the semantics may define the strategy by which expressions are evaluated to values, or the manner in which control structures conditionally execute statements.

Signal (IPC)

signalsignalsSIGINT
Interrupts and signals are low-level mechanisms that can alter the flow of control in a way similar to a subroutine, but usually occur as a response to some external stimulus or event (that can occur asynchronously), rather than execution of an in-line control flow statement.
When a signal is sent, the operating system interrupts the target process' normal flow of execution to deliver the signal.

Continuation

continuationscalloutscontinuation-based web programming
Conditions, exceptions and continuations are three common sorts of non-local control constructs; more exotic ones also exist, such as generators, coroutines and the async keyword.
In computer science and computer programming, a continuation is an abstract representation of the control state of a computer program.

Branch (computer science)

branchconditional branchbranches
For some central processing units (CPUs), the only control flow instructions available are conditional or unconditional branch instructions, also termed jumps.
Branch instructions are used to implement control flow in program loops and conditionals (i.e., executing a particular sequence of instructions only if certain conditions are satisfied).

Block (programming)

blockblocksblock structured
A set of statements is in turn generally structured as a block, which in addition to grouping, also defines a lexical scope.
Blocks are fundamental to structured programming, where control structures are formed from blocks.

Instruction set architecture

instruction setinstructionsinstruction
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.
More complex operations are built up by combining these simple instructions, which are executed sequentially, or as otherwise directed by control flow instructions.

C (programming language)

CC programming languageC language
In other languages such as C and Ada, a label is an identifier, usually appearing at the start of a line and immediately followed by a colon.
These languages have drawn many of their control structures and other basic features from C. Most of them (Python being a dramatic exception) also express highly similar syntax to C, and they tend to combine the recognizable expression and statement syntax of C with underlying type systems, data models, and semantics that can be radically different.

Modular programming

modulesmodularmodule
If many programmers are working on one program, subroutines are one kind of modularity that can help divide the work.
While the historical usage of these terms has been inconsistent, "modular programming" now refers to high-level decomposition of the code of an entire program into pieces: structured programming to the low-level code use of structured control flow, and object-oriented programming to the data use of objects, a kind of data structure.

Computer program

programprogramscomputer programs
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.
Declarative programs omit the control flow and are considered sets of instructions.

Machine code

machine languagenative codemachine instruction
At the level of machine language or assembly language, control flow instructions usually work by altering the program counter.
Program flow may be influenced by special 'jump' instructions that transfer execution to an instruction other than the numerically following one.

Central processing unit

CPUprocessorprocessors
For some central processing units (CPUs), the only control flow instructions available are conditional or unconditional branch instructions, also termed jumps.
Some instructions manipulate the program counter rather than producing result data directly; such instructions are generally called "jumps" and facilitate program behavior like loops, conditional program execution (through the use of a conditional jump), and existence of functions.

Reserved word

keywordkeywordsreserved keyword
Although the keyword may either be in upper or lower case depending on the language, it is usually written as:
Keywords have varied uses, but primarily fall into a few classes: part of the phrase grammar (specifically a production rule with nonterminal symbols), with various meanings, often being used for control flow, such as the word in most procedural languages, which indicates a conditional and takes clauses (the nonterminal symbols); names of primitive types in a language that support a type system, such as ; primitive literal values such as for Boolean true; or sometimes special commands like.

Program counter

instruction pointerPCprogram counter (PC)
At the level of machine language or assembly language, control flow instructions usually work by altering the program counter.
Thus programmers write a sequential control flow even for algorithms that do not have to be sequential.

Indentation style

indentationindent style1TBS
Especially, it is used to clarify the link between control flow constructs such as conditions or loops, and code contained within and outside of them.

Boolean data type

booleanBoolean variableBoolean value
The Boolean data type is primarily associated with conditional statements, which allow different actions by changing control flow depending on whether a programmer-specified Boolean condition evaluates to true or false.

Switch statement

switchcase statementCASE structure
Switch statements (or case statements, or multiway branches) compare a given value with specified constants and take action according to the first constant to match.
In computer programming languages, a switch statement is a type of selection control mechanism used to allow the value of a variable or expression to change the control flow of program execution via search and map.

Statement (computer science)

statementstatementscompound statement
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.
For languages without call-by-name parameters the semantic description of a loop or conditional is usually beyond the capabilities of the language.

BASIC

BASIC programming languageGOSUBcompiled BASIC
Line numbers are an alternative to a named label (and used in some languages such as BASIC), that are whole numbers placed at the start of each line of text in the source code.
More important were the facilities for structured programming, including additional control structures and proper subroutines supporting local variables.

Infinite loop

endless loopinfinite loops '''while''' '''True'''
The code "inside" the loop (the body of the loop, shown below as xxx) is obeyed a specified number of times, or once for each of a collection of items, or until some condition is met, or indefinitely.
An infinite loop (or endless loop) is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over.

Scope (computer science)

scopelexical scopeLexical
A set of statements is in turn generally structured as a block, which in addition to grouping, also defines a lexical scope.
Introducing a local variable with name pushes a binding onto the global stack (which may have been empty), which is popped off when the control flow leaves the scope.

Perl

Perl 5Perl programming languagePerl Script
Several programming languages (e.g., Ada, D, C++11, Smalltalk, PHP, Perl, Object Pascal, Java, C#, MATLAB, Visual Basic, Ruby, Python, JavaScript, Fortran 95 and later) have special constructs which allow implicit looping through all elements of an array, or all members of a set or collection.
The overall structure of Perl derives broadly from C. Perl is procedural in nature, with variables, expressions, assignment statements, brace-delimited blocks, control structures, and subroutines.

PHP

PHP5PDOPHP programming language
Several programming languages (e.g., Ada, D, C++11, Smalltalk, PHP, Perl, Object Pascal, Java, C#, MATLAB, Visual Basic, Ruby, Python, JavaScript, Fortran 95 and later) have special constructs which allow implicit looping through all elements of an array, or all members of a set or collection.
Anything outside its delimiters is not processed by PHP, although non-PHP text is still subject to control structures described in PHP code.

Off-side rule

indentationsignificant whitespaceline-oriented design
While this allows for more freedom – the developer might choose not to indent small pieces of code like the break and continue statements – sloppily indented code might lead the reader astray.

Tail call

tail recursiontail-recursivetail call optimization
Tail recursion is a special case of recursion which can be easily transformed to iteration.
However, in functional programming languages, tail call elimination is often guaranteed by the language standard, allowing tail recursion to use a similar amount of memory as an equivalent loop.