title: creating a menu in prolog?
body: <pre><code>menu :-
      repeat,
      write('                          '),nl,
      write('   1.the number of hello  '),nl,
      write('                          '),nl,
      write('enter your choice:'),nl,
      read(Choice), Choice&gt;0, Choice =&lt;6,
      doit(Choice),Choice=6.
  
  
  doit(1):- numberofhello(N).
  doit(6):- abort.
  
  my_list([hello,hello,hello]).
  
  
  counthowmany(_, [], 0) :- !.
  counthowmany(X, [X|Q], N) :- !, counthowmany(X, Q, N1), N is N1+1.
  counthowmany(X, [_|Q], N) :- counthowmany(X, Q, N).
  
  
  numberofhello(N) :- my_list(L),counthowmany(hello,L,N).
  </code></pre>
  
  <p>now in the code above after compile buffer when I ask Prolog for a menu the menu appears
  with one choice and when i enter 1 for number of hello in the list(my_list) i don't get any answer and i get a singleton variable warning while compiling .....</p>
  
  <p>can anyone help me please........</p>