home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / sampler / 03 / diverse / recurdmo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-09-09  |  659 b   |  44 lines

  1. { RECURDMO.PAS }
  2. {
  3. Description:  Simple program to demonstrate the concept of recursion
  4.  
  5. Author:       Don Taylor
  6. Date:         4/1/88
  7. Last revised: 04/01/88  14:32
  8. Application:  IBM PC and compatibles; Turbo Pascal 4.0
  9.  
  10. }
  11.  
  12. PROGRAM RecursionDemo;
  13.  
  14. USES
  15.  Crt;
  16.  
  17. CONST
  18.  MaxDepth = 12;
  19.  
  20. VAR
  21.  s     : STRING;
  22.  Level : WORD;
  23.  
  24. {-------------------}
  25.  
  26. PROCEDURE PrintLevel;
  27.  
  28. BEGIN
  29.  WRITELN(s, Level);
  30.  Level := SUCC(Level);
  31.  IF Level < MaxDepth THEN PrintLevel
  32. END; { PrintLevel }
  33.  
  34. {====================}
  35.  
  36. BEGIN { RecursionDemo }
  37.  ClrScr;
  38.  Level := 0;
  39.  s     := 'The current level is ';
  40.  PrintLevel
  41. END. { RecursionDemo }
  42.  
  43. 
  44.