title: Call by need vs call by name
body: <p>I didn't understand the diffrence between Call-by-name and Call-by-need. As I understood, Call-by-need method restores the answer returned. But how It helps us, and Is there any fundamental difference between the results ?</p>
  
  <p>For example,</p>
  
  <pre><code>begin integer n;
    procedure foo(e, n);
    integer e, n;
    begin
      for n := 1 step 1 until 10 do begin
        prints(`;;; the value of e is ');
        printnln(e)
      end
    end;
    foo(2 * n, n)
  end
  </code></pre>
  
  <p>So in call-by-name, as I understood, We will get:</p>
  
  <pre><code>;;; the value of e is 2
  ;;; the value of e is 4
  ;;; the value of e is 8
  </code></pre>
  
  <p>and so on. This is because we pass <code>2*n</code> to <code>e</code>, and <code>e</code> is evaluate with the new <code>i</code> everytime.
  What would happen in call-by-need? </p>