{
  "id": "enwiki-001309972637",
  "slug": "label-computer-science",
  "title": "Label (computer science)",
  "qid": "",
  "lead": "In programming languages, a label is a sequence of characters that identifies a location within source code. In most languages, labels take the form of an identifier, often followed by a punctuation character (e.g., a colon). In many high-level languages, the purpose of a label is to act as the destination of a GOTO statement. In assembly language, labels can be used anywhere an address can (for example, as the operand of a JMP or MOV instruction). Also in Pascal and its derived variations. Some languages, such as Fortran and BASIC, support numeric labels. Labels are also used to identify an entry point into a compiled sequence of statements (e.g., during debugging).",
  "body": "In programming languages, a label is a sequence of characters that identifies a location within source code. In most languages, labels take the form of an identifier, often followed by a punctuation character (e.g., a colon). In many high-level languages, the purpose of a label is to act as the destination of a GOTO statement. In assembly language, labels can be used anywhere an address can (for example, as the operand of a JMP or MOV instruction). Also in Pascal and its derived variations. Some languages, such as Fortran and BASIC, support numeric labels. Labels are also used to identify an entry point into a compiled sequence of statements (e.g., during debugging). void foo(int number) { if (number Here error is the label. The statement goto can be used to jump to a labeled statement in the code. After a goto , program execution continues with the statement after the label. switch (die) { default: printf(\"invalid\\n\"); break; case 1: case 3: case 5: printf(\"odd\\n\"); break; case 2: case 4: case 6: printf(\"even\\n\"); break; } Within a single switch statement, the integer constant associated with each case label must be unique. There may or may not be a default statement. There is no restriction on the order of the labels within a switch. The requirement that case labels values evaluate to integer constants gives the compiler more room for optimizations. top: //Label the outermost for-loop. for (var i = 0; i It also possible to use break statement to break out of the code blocks: top: { console.log(\"foo\") console.log(\"bar\") break top console.log(\"baz\") } // Which would output: // > foo // > bar (let ((iteration NIL)) (tagbody start (print 'started) (setf iteration 0) increase (print iteration) (incf iteration 1) (go check) check (if (>= iteration 10) (go end) (go increase)) end (print 'done))) A second method utilizes the reader macros #n= and #n# , the former of which labels the object immediately following it, the latter refers to its evaluated value. Labels in this sense constitute rather an alternative to variables, with #n= declaring and initializing a “variable” and #n# accessing it. The placeholder n designates a chosen unsigned decimal integer identifying the label. (progn #1=\"hello\" (print #1#)) Apart from that, some forms permit or mandate the declaration of a label for later referral, including the special form block which prescribes a naming, and the loop macro that can be identified by a named clause. Immediate departure from a named form is possible by using the return-from special operator. (block myblock (loop for iteration from 0 do (if (>= iteration 10) (return-from myblock 'done) (print iteration)))) (loop named myloop for iteration from 0 do (if (>= iteration 10) (return-from myloop 'done) (print iteration))) In a fashion similar to C, the macros case , ccase , ecase , typecase , ctypecase and etypecase define switch statements. (let ((my-value 5)) (case my-value (1 (print \"one\")) (2 (print \"two\")) ((3 4 5) (print \"three four or five\")) (otherwise (print \"any other value\")))) (let ((my-value 5)) (typecase my-value (list (print \"a list\")) (string (print \"a string\")) (number (print \"a number\")) (otherwise (print \"any other type\")))) ==See also== Line number ==References==",
  "categories": [
    "20416984",
    "23118434",
    "23603337",
    "23837581",
    "25538166",
    "28043571",
    "36975041",
    "95814580"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1309972637",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1757198142.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001309972637",
    "type": "webpage",
    "title": "Label (computer science)",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/label-computer-science",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          18
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          18
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001309972637",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1309972637",
    "note": "Immutable snapshot enwiki-001309972637"
  }
}