title: How do I make a procedure change the value of a variable argument?
body: <p>I tried to make a simple procedure that would remove spaces from an inputted string:</p>
  
  <pre><code>procedure RemoveSpaces(StringParameter : String);
  var
     SpacePosition: Integer;
  begin
     SpacePosition := Pos(' ',StringParameter);
     while SpacePos &lt;&gt; 0 do
     begin
        Delete(StringParameter,SpacePos,1);
        SpacePosition := Pos(' ',StringParameter);
     end;
  end;
  </code></pre>
  
  <p>but after testing the procedure in the following code:</p>
  
  <pre><code>var
     Input : String;
  begin
     Readln(Input);
     RemoveSpaces(Input);
     Writeln(Input);
     Readln;
  end.
  </code></pre>
  
  <p>it was clear that the Input variable was simply regurgitated out of the procedure as if it was never changed.</p>
  
  <p>I thought it might just be some limit to what I can do with procedures that I had just not yet realized but then I remembered that I had previously made a procedure that takes a StringList parameter and alphabetically sorts the Strings in the StringList and saves the changes to the StringList variable argument:</p>
  
  <pre><code>var
     myStringList : TStringList;
  
  implementation
  
  procedure StringListSort(StringList : TStringList);
  begin
     //Sort StringList
  end;
  
  procedure TFormName.ButtonNameClick(Sender: TObject);
  begin
     StringListSort(myStringList);
  end; 
  </code></pre>
  
  <p>Any solution to my problem is welcomed.</p>