Résumé
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).
À propos de ce résultat
Cette page est générée automatiquement et peut contenir des informations qui ne sont pas correctes, complètes, à jour ou pertinentes par rapport à votre recherche. Il en va de même pour toutes les autres pages de ce site. Veillez à vérifier les informations auprès des sources officielles de l'EPFL.