Summary
In computer programming, a statement is a syntactic unit of an imperative programming language that expresses some action to be carried out. A program written in such a language is formed by a sequence of one or more statements. A statement may have internal components (e.g. expressions). Many programming languages (e.g. Ada, Algol 60, C, Java, Pascal) make a distinction between statements and definitions/declarations. A definition or declaration specifies the data on which a program is to operate, while a statement specifies the actions to be taken with that data. Statements which cannot contain other statements are simple; those which can contain other statements are compound. The appearance of a statement (and indeed a program) is determined by its syntax or grammar. The meaning of a statement is determined by its semantics. Simple statements are complete in themselves; these include assignments, subroutine calls, and a few statements which may significantly affect the program flow of control (e.g. goto, return, stop/halt). In some languages, input and output, assertions, and exits are handled by special statements, while other languages use calls to predefined subroutines. assignment Fortran: variable = expression Pascal, Algol 60, Ada: variable := expression; C, C#, C++, PHP, Java: variable = expression; call Fortran: CALL subroutine name(parameters) C, C++, Java, PHP, Pascal, Ada: subroutine name(parameters); assertion C, C++, PHP: assert(relational expression); Java: assert relational expression; goto Fortran: GOTO numbered-label Algol 60: goto label; C, C++, PHP, Pascal: goto label; return Fortran: RETURN value C, C++, Java, PHP: return value; stop/halt/exit Fortran: STOP number C, C++: exit(expression) PHP: exit number; Compound statements may contain (sequences of) statements, nestable to any reasonable depth, and generally involve tests to decide whether or not to obey or repeat these contained statements. Notation for the following examples: is any single statement (could be simple or compound).
About this result
This page is automatically generated and may contain information that is not correct, complete, up-to-date, or relevant to your search query. The same applies to every other page on this website. Please make sure to verify the information with EPFL's official sources.