Control flow: Difference between revisions

Content deleted Content added
Undid revision 1297416369 by 154.191.216.59 (talk)
Tags: Undo Reverted
No edit summary
Tags: Manual revert Reverted section blanking Mobile edit Mobile web edit
Line 11:
 
At the level of [[machine language]] or [[assembly language]], control flow instructions usually work by altering the [[program counter]]. For some [[central processing unit]]s (CPUs), the only control flow instructions available are conditional or unconditional [[Branch (computer science)|branch]] instructions, also termed jumps.
 
== Categories ==
[[File:Maldi informatics figure 7.JPG|thumb|upright=1.3|A [[state diagram]] of a peptide ion mass mapping search process]]
The kinds of control flow statements supported by different languages vary, but can be categorized by their effect:
* Continuation at a different statement (unconditional [[Branch (computer science)|branch]] or jump)
* Executing a set of statements only if some condition is met (choice - i.e., [[conditional branch]])
* Executing a set of statements zero or more times, until some condition is met (i.e., loop - the same as [[conditional branch]])
* Executing a set of distant statements, after which the flow of control usually returns ([[subroutine]]s, [[coroutine]]s, and [[continuation]]s)
* Stopping the program, preventing any further execution (unconditional halt)
 
== Primitives ==