Statement

esse quam videri
Revision as of 18:34, 16 April 2020 by Kspriggs01 (talk | contribs) (Examples)
Jump to: navigation, search

Definition

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.

Examples

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

Return Statement:

Resources

See also

- Keyword

External Links