Contents 1 Kinds of statements 1.1 Simple statements 1.2 Compound statements 2 Syntax 3 Semantics 4 Expressions 5 Extensibility 6 See also 7 References 8 External links


Kinds of statements[edit] The following are some of the major generic kinds of statements, pseudocoded. These pseudocoded statements have an immediate corresponding syntax in any typical imperative language like Pascal, C, Fortran etc.: Simple statements[edit] assertion in C: assert(ptr != NULL); assignment in Pascal: A := A + 5 in C and Fortran: A = A + 5 goto in Fortran: goto label; return in C, Pascal and Fortran: return value; call in C and Pascal: CLEARSCREEN() in Fortran: call CLEARSCREEN() Compound statements[edit] block: in Pascal: begin ... end in C: { ... } do-loop: do { computation(&i); } while (i < 10); for-loop: for A := 1 to 10 do WRITELN(A) end if-statement: if A > 3 then WRITELN(A) else WRITELN("NOT YET"); end switch-statement: switch (c) { case 'a': alert(); break; case 'q': quit(); break; } while-loop: while NOT EOF do begin READLN end with-statement: with open(filename) as f: use(f)


Syntax[edit] The appearance of statements shapes the look of programs. Programming languages are characterized by the type of statements they use (e.g. the curly brace language family). Many statements are introduced by identifiers like if, while or repeat. Often statement keywords are reserved such that they cannot be used as names of variables or functions. Imperative languages typically use special syntax for each statement, which looks quite different from function calls. Common methods to describe the syntax of statements are Backus–Naur form and syntax diagrams.


Semantics[edit] Semantically many statements differ from subroutine calls by their handling of parameters. Usually an actual subroutine parameter is evaluated once before the subroutine is called. This contrasts to many statement parameters that can be evaluated several times (e.g. the condition of a while loop) or not at all (e.g. the loop body of a while loop). Technically such statement parameters are call-by-name parameters. Call-by-name parameters are evaluated when needed (see also lazy evaluation). When call-by-name parameters are available a statement like behaviour can be implemented with subroutines (see Lisp). For languages without call-by-name parameters the semantic description of a loop or conditional is usually beyond the capabilities of the language. Therefore, standard documents often refer to semantic descriptions in natural language.


Expressions[edit] In most languages, statements contrast with expressions in that statements do not return results and are executed solely for their side effects, while expressions always return a result and often do not have side effects at all. Among imperative programming languages, Algol 68 is one of the few in which a statement can return a result. In languages that mix imperative and functional styles, such as the Lisp family, the distinction between expressions and statements is not made: even expressions executed in sequential contexts solely for their side effects and whose return values are not used are considered 'expressions'. In purely functional programming, there are no statements; everything is an expression. This distinction is frequently observed in wording: a statement is executed, while an expression is evaluated. This is found in the exec and eval functions found in some languages: in Python both are found, with exec applied to statements and eval applied to expressions.


Extensibility[edit] Most languages have a fixed set of statements defined by the language, but there have been experiments with extensible languages that allow the programmer to define new statements.


See also[edit] Comparison of Programming Languages - Statements Control flow Expression (contrast) Extensible languages


References[edit] ^ "statement". webopedia. Retrieved 2015-03-03. 


External links[edit] PC ENCYCLOPEDIA: Definition of: program statement Authority control GND: 4458688-7 Retrieved from "https://en.wikipedia.org/w/index.php?title=Statement_(computer_science)&oldid=816908549" Categories: Programming language conceptsStatementsHidden categories: Wikipedia articles with GND identifiers


Navigation menu Personal tools Not logged inTalkContributionsCreate accountLog in Namespaces ArticleTalk Variants Views ReadEditView history More Search Navigation Main pageContentsFeatured contentCurrent eventsRandom articleDonate to WikipediaWikipedia store Interaction HelpAbout WikipediaCommunity portalRecent changesContact page Tools What links hereRelated changesUpload fileSpecial pagesPermanent linkPage informationWikidata itemCite this page Print/export Create a bookDownload as PDFPrintable version Languages ČeštinaDanskDeutschEsperanto한국어HrvatskiമലയാളംNederlands日本語Олык марийPolskiРусскийСрпски / srpskiSuomiSvenskaУкраїнськаTiếng Việt中文 Edit links This page was last edited on 24 December 2017, at 16:01. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization. Privacy policy About Wikipedia Disclaimers Contact Wikipedia Developers Cookie statement Mobile view (window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgPageParseReport":{"limitreport":{"cputime":"0.088","walltime":"0.123","ppvisitednodes":{"value":420,"limit":1000000},"ppgeneratednodes":{"value":0,"limit":1500000},"postexpandincludesize":{"value":3336,"limit":2097152},"templateargumentsize":{"value":308,"limit":2097152},"expansiondepth":{"value":7,"limit":40},"expensivefunctioncount":{"value":0,"limit":500},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 102.383 1 -total"," 67.27% 68.868 1 Template:Reflist"," 56.39% 57.729 1 Template:Cite_web"," 28.85% 29.542 1 Template:Authority_control"," 3.47% 3.549 7 Template:Visible_anchor"," 2.81% 2.874 1 Template:Main_other"]},"scribunto":{"limitreport-timeusage":{"value":"0.044","limit":"10.000"},"limitreport-memusage":{"value":1583706,"limit":52428800}},"cachereport":{"origin":"mw1321","timestamp":"20180217150207","ttl":1900800,"transientcontent":false}}});});(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":92,"wgHostname":"mw1322"});});


Statement_(programming) - Photos and All Basic Informations

Statement_(programming) More Links

Computer ProgrammingImperative ProgrammingProgramming LanguageExpression (computer Science)C (programming Language)Identifier (computer Programming)Assertion (computing)Assignment (computer Science)GOTOReturn StatementSubroutineBlock (programming)Do While LoopFor LoopConditional (programming)Switch StatementWhile LoopCurly Brace LanguageIdentifier (computer Programming)Keyword (computer Programming)Variable (programming)Function (computer Science)Backus–Naur FormSyntax DiagramSubroutineParameter (computer Science)While LoopCall-by-nameLazy EvaluationLisp (programming Language)Control FlowConditional (programming)Expression (programming)Side Effect (programming)Algol 68Functional ProgrammingLisp (programming Language)Purely Functional ProgrammingEvalExtensible LanguagesComparison Of Programming Languages (syntax)Control FlowExpression (programming)Extensible LanguagesHelp:Authority ControlIntegrated Authority FileHelp:CategoryCategory:Programming Language ConceptsCategory:StatementsCategory:Wikipedia Articles With GND IdentifiersDiscussion About Edits From This IP Address [n]A List Of Edits Made From This IP Address [y]View The Content Page [c]Discussion About The Content Page [t]Edit This Page [e]Visit The Main Page [z]Guides To Browsing WikipediaFeatured Content – The Best Of WikipediaFind Background Information On Current EventsLoad A Random Article [x]Guidance On How To Use And Edit WikipediaFind Out About WikipediaAbout The Project, What You Can Do, Where To Find ThingsA List Of Recent Changes In The Wiki [r]List Of All English Wikipedia Pages Containing Links To This Page [j]Recent Changes In Pages Linked From This Page [k]Upload Files [u]A List Of All Special Pages [q]Wikipedia:AboutWikipedia:General Disclaimer



view link view link view link view link view link