Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Structured programming
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Elements== ===Control structures=== Following the [[structured program theorem]], all programs are seen as composed of three [[control structure]]s: * "Sequence"; ordered statements or subroutines executed in sequence. * "Selection"; one of a number of statements is executed depending on the state of the program. This is usually expressed with [[Keyword (computer programming)|keyword]]s such as [[Conditional (programming)|<code>if..then..else..endif</code>]]. The conditional statement should have at least one true condition and each condition should have one exit point at max. * "Iteration"; a statement or block is executed until the program reaches a certain state, or operations have been applied to every element of a collection. This is usually expressed with keywords such as [[While loop|<code>while</code>]], [[Do while loop|<code>repeat</code>]], [[For loop|<code>for</code>]] or [[Do while loop|<code>do..until</code>]]. Often it is recommended that each loop should only have one entry point (and in the original structural programming, also only one exit point, and a few languages enforce this). [[File:Structured_program_patterns.svg|thumb|649x649px|center|Graphical representation of the [[structured program theorem|three basic patterns]] — sequence, selection, and repetition — using [[Nassi–Shneiderman diagram|NS diagrams]] (blue) and [[flow chart]]s (green).]] ===Subroutines=== [[Subroutine]]s; callable units such as procedures, functions, methods, or subprograms are used to allow a sequence to be referred to by a single statement. ===Blocks=== [[Block (programming)|Blocks]] are used to enable groups of statements to be treated as if they were one statement. ''Block-structured'' languages have a syntax for enclosing structures in some formal way, such as an if-statement bracketed by <code>if..fi</code> as in [[ALGOL 68]], or a code section bracketed by <code>BEGIN..END</code>, as in [[PL/I]] and [[Pascal (programming language)|Pascal]], [[whitespace character|whitespace]] indentation as in [[Python (programming language)|Python]], or the curly braces <code>{...}</code> of [[C (programming language)|C]] and [[Curly brace family#Curly-bracket languages|many later languages]].
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Structured programming
(section)
Add topic