title: How does this program to count vowels work?
body: <p>I want to understand this code, especially <code>PROCEDURE</code></p>
  <pre><code>PROGRAM vowels; 
  
  USES crt; 
  
  {Program that counts the number of vowels in a sentence} 
  
  CONST space=' '; 
        maxchar=80; 
  
  TYPE vowel=(a,e,i,o,u); 
  
  VAR buffer:ARRAY[1..maxchar] of char; 
      vowelcount:ARRAY[vowel] of integer; 
  
  PROCEDURE initialize; 
  
  VAR ch:vowel; 
  
  BEGIN 
       FOR ch:=a TO u DO 
       BEGIN 
            vowelcount[ch]:=0; 
       END; 
  END; 
  
  PROCEDURE textinput; 
  
  VAR index:integer; 
  
  BEGIN 
       writeln('Input a sentence'); 
       FOR index:=1 TO maxchar DO 
           IF eoln THEN buffer[index]:=space 
           ELSE read(buffer[index]); 
           readln; 
  END; 
  
  PROCEDURE analysis; 
  
  VAR index:integer; 
      ch:vowel; 
  
  BEGIN 
       index:=1; 
       WHILE index&lt;&gt;maxchar+1 DO 
       BEGIN 
            IF buffer[index] IN ['a','e','i','o','u'] THEN 
            BEGIN 
                 CASE buffer[index] OF 
                 'a':ch:=a; 
                 'e':ch:=e; 
                 'i':ch:=i; 
                 'o':ch:=o; 
                 'u':ch:=u; 
                 END; 
                 vowelcount[ch]:=vowelcount[ch]+1; 
            END; 
            index:=index+1; 
       END; 
  END; 
  
  PROCEDURE vowelout; 
  
  VAR ch:vowel; 
  
  BEGIN 
       clrscr; 
       writeln; 
       writeln('   a   e   i   o   u'); 
       FOR ch:=a TO u DO 
       write(vowelcount[ch]:4); 
       writeln; 
  END; 
  
  BEGIN 
       initialize; 
       textinput; 
       analysis; 
       vowelout; 
  END;
  </code></pre>