esse quam videri
Revision as of 18:37, 16 April 2020 by Kspriggs01 (talk | contribs) (Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


A statement is similar to command, where it is used to dictate the logical flow of an application by stating what should be done when. All applications contain many different statements in order for it to fulfill the purpose it was built for.

All statements are also reserved as keywords within their respective languages.


Block Statement:

A block of code that is defined between two curly braces. Often used when defining the actions a method should take or when establishing get/set for a property within a class.

If/Else Statement:

A statement that will see if a certain condition is true and then perform a stated action if it is, otherwise if it is false it will perform another action. This other action can be to check another condition, and thus these statements can be "chained" in order to further dictate logical flow.

Switch Statement

A statement that will check the value of an expression and determine what action should be taken based off of the cases described within it. If the value is equivalent to any of said cases then the instructions for said case will execute, otherwise the default case will run.

For Statement:

A statement that defines a recursive command within its body, with iteration being used in order to determine the conditions in which the loop should continue or end. The term "for" relates to the conditions defined within the statement's header, which can be simplified as "if this variable is set to this value and this test condition returns true, execute the code in the body and iterate on this variable". This will repeat until the test condition is no longer satisfied.

While Statement:

A recursive statement that states that, as long as the value within its expression is true, the code within its body should be executed. It can be simplified as "while this is true, do this".

Return Statement:

A statement that specifies an output value for a condition, which is required in methods that do not have a return value of "void".


See also

- Keyword

External Links