title: What happens in background when passing parameters as variable in a function
body: <p>I readed some theorical information about this in some places, but I didn't understand yet...</p>
  
  <p>Let's supose I have this functions and procedures:</p>
  
  <pre><code>function ProcessVars1(var param1: type1; var param2: type2; var param3: type3): Boolean;
  function ProcessVars2(var param1: type1; var param2: type2; var param3: type3): Boolean;
  function ProcessVars3(var param1: type1; var param2: type2; var param3: type3): Boolean;
  function ProcessVarsX(var param1: type1; var param2: type2; var param3: type3): Boolean;
  
  function ProcessVars(const x: Integer; var param1: type1; var param2: type2; var param3: type3): Boolean;
  var
    Res: Boolean;
  begin
    case x of
      1: Res := ProcessVars1(param1, param2, param3);
      2: Res := ProcessVars2(param1, param2, param3);
      3: Res := ProcessVars3(param1, param2, param3);
      ...
    end;
    Result := Res;
  end;
  
  procedure DoSomething;
  var
    x: integer;
    var1: type1;
    var2: type2;
    var3: type3;
  begin
    // Determine X
    x := 1;  
    if ProcessVars(x, var1, var2, var3) then
    begin
      // Use var1, var2 and var3
    end;
  end;
  </code></pre>
  
  <p>What I'd like to know is when calling the "DoSomething" procedure, are variables var1, var2 and var3 created in memory only one time, or 3 times?</p>
  
  <p>Is there a way to avoid creating the variables each time the function is called? I mean, ProcessVars and ProcessVarsX only change the variable content, without creating it again in memory?</p>
  
  <p>Thanks!</p>