title: Why is this recursive Pascal procedure not being caught in an infinite loop?
body: <p>I wonder why the following recursive Pascal procedure actually terminates:</p>
  <pre><code>procedure reverseWordRecursive;
  
    var
    word : char;
  
  begin
    read(word);
    if word = '.' then
      writeln
    else
      begin
        reverseWordRecursive;
        write(word)
      end;
  end; {reverseWordRecursive}
  </code></pre>
  <p>The procedure acts differently as the code might suggest. When you run the code the call of <code>read(word)</code> only runs once in the beginning of the procedure. The user is not asked to input one single <code>char</code> at the beginning of each recursive call, but you rather input the whole <code>string</code> of <code>char</code>.</p>
  <p>Why is it not being caught in an infinite loop at the &quot;read(word)&quot; call? Should it not ask the user to input a word for ever?</p>
  <p>How does the procedure know to actually use the respective next character for each recursive call?</p>