Begin: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Begin
| Old | New | Line | |
|---|---|---|---|
| 1 | + | The [[Reserved word|reserved word]] `begin` marks the start of the definition of the executable portion of a [[Block|block]]. In conjunction with [[End|end]] it is also used to group [[statement|statements]] into a so-called “compound statement”. | |
| 2 | + | ||
| 3 | + | > **Note:** In [[Pascal]] a compound statement does not create a new scope. Only blocks do. | |
| 4 | + | ||
| 5 | + | In [[Extended Pascal|extended Pascal]] `to begin do …` starts the definition of the [[Initialization|initialization part of a module]]. | |
| 6 | + | ||
| 7 | + | While every `begin` must have a corresponding `end`, not all occurrences of `end` have a corresponding `begin`. | |
| 8 | + | ||
| 9 | + | ## syntax justification | |
| 10 | + | ||
| 11 | + | Lots of programming languages use a pair of single characters to indicate boundaries. Typing out the words `begin` and `end` is indeed more cumbersome than writing `{ }`. However, the meaning of such characters is not as obvious as words are. | |
| 12 | + | ||
| 13 | + | ## matching | |
| 14 | + | ||
| 15 | + | - The source editor of the [[Lazarus IDE]] supports a “find matching begin/end” function. | |
| 16 | + | - [[vim]] can be configured to support matching Pascal’s `begin`/`end`, too. | |
| 17 | + | ||
| 18 | + | --- | |
| 19 | + | *From the Free Pascal wiki, page "Begin", as it stood on 2021-08-21 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
