home *** CD-ROM | disk | FTP | other *** search
- { RECURDMO.PAS }
- {
- Description: Simple program to demonstrate the concept of recursion
-
- Author: Don Taylor
- Date: 4/1/88
- Last revised: 04/01/88 14:32
- Application: IBM PC and compatibles; Turbo Pascal 4.0
-
- }
-
- PROGRAM RecursionDemo;
-
- USES
- Crt;
-
- CONST
- MaxDepth = 12;
-
- VAR
- s : STRING;
- Level : WORD;
-
- {-------------------}
-
- PROCEDURE PrintLevel;
-
- BEGIN
- WRITELN(s, Level);
- Level := SUCC(Level);
- IF Level < MaxDepth THEN PrintLevel
- END; { PrintLevel }
-
- {====================}
-
- BEGIN { RecursionDemo }
- ClrScr;
- Level := 0;
- s := 'The current level is ';
- PrintLevel
- END. { RecursionDemo }
-
-