title: Adding variable to list in prolog
body: <p>I'm trying to work out how to add a name to a list in Prolog by prompting the user for the name then grabbing that list from the function, but I'm not sure how append works in this scenario:</p>
  
  <pre><code>test:-
      addname(Names),
      write(Names).
  
  addname(Names):-
      write('Enter name followed by . (s. to stop)'),
      read(Name), nl,
      (Name = 's') -&gt;
          true; %% exit procedure
          append(Names, Name, New),
          addname(Names).
  </code></pre>
  
  <p>Can someone point me in the right direction?</p>