Читать книгу Beginning Programming All-in-One For Dummies - Wallace Wang - Страница 38

STRUCTURED PROGRAMMING AND PASCAL

Оглавление

You can use structured programming techniques with any programming language, including machine language or assembly language (see Book 1, Chapter 1). However, the one language most closely associated with structured programming is Pascal.

Unlike other languages that later adopted structured programming, Pascal was designed to encourage (force) programmers to use structured programming from the start. A typical Pascal program may look like this:

Program Print2Lines;Begin Writeln ('This line prints first'); Writeln ('This line prints second');End.

Without knowing anything about the Pascal language, you can immediately make sense out of what it does.

 First, it prints the line, This line prints first.

 Next, it prints the second line, This line prints second.

Unlike the BASIC example that allows spaghetti programming (see “Spaghetti programming with the GOTO command,” earlier in this chapter), Pascal forces programmers to structure programs using sequences, branches, and loops. As a result, Pascal helps programmers create well-organized programs that are much easier to read and understand.

Beginning Programming All-in-One For Dummies

Подняться наверх