Pascal Programming/Appendix

Jumps
Usage of jumps are deemed bad practice. This topic has deliberately not been covered in any of the previous chapters, but for the sake of completeness it is explained in the appendix.

Using labels
Standard Pascal includes the infamous "goto" statement. It redirects the computer to a labeled statement somewhere else in the program. Labels are unsigned integers, although some compilers allow them to be words.

Declaring labels
If you use any labels, you are required to declare them ahead of time just as you would variables or constants.

Avoiding labels
In some early programming languages, labeled jumps were the primary way of controlling the flow of execution. Too many labels and "goto" statements will read to unreadable code. Today, we would generally be expected to rewrite such code with the more specific control flow structures, like so: