- Pascal Tutorial
- Pascal Useful Resources
- Selected Reading
Dalam C terdapat 3 macam struktur perulangan, yaitu: Struktur For, Struktur While dan Struktur Do While. Pada kesempatan kali ini kita akan membahas mengenai 3 macam struktur perulangan tersebut lengkap dengan contoh program beserta penjelasannya, dimana contoh program kami buat menggunakan IDE Dev-C. Pascal - goto Statement - A goto statement in Pascal provides an unconditional jump. Program exGoto; label 1; var a: integer; begin a:= 10; (. repeat until loop.
A goto statement in Pascal provides an unconditional jump from the goto to a labeled statement in the same function.
NOTE − Use of goto statement is highly discouraged in any programming language because it makes difficult to trace the control flow of a program, making the program hard to understand and hard to modify. Any program that uses a goto can be rewritten so that it doesn't need the goto.
Syntax
The syntax for a goto statement in Pascal is as follows −
Here, label must be an unsigned integer label, whose value can be from 1 to 9999.
Flow Diagram
Example
The following program illustrates the concept.
When the above code is compiled and executed, it produces the following result −
Please note that −
- In Pascal, all labels must be declared before constant and variable declarations.
- The if and goto statements may be used in the compound statement to transfer control out of the compound statement, but it is illegal to transfer control into a compound statement.
pascal_loops.htm