home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / REFEXAMP.ARC / KEYPRSSD.PRO < prev    next >
Encoding:
Text File  |  1988-06-21  |  382 b   |  18 lines

  1. %====================== keypressed/0          ===============================
  2. PREDICATES
  3.   count(INTEGER)
  4.   loop
  5.  
  6. CLAUSES
  7.   count(X):-keypressed,!,write("\nCounted to: ",X).
  8.   count(X):-X1=X+1,count(X1).
  9.  
  10.   loop:-
  11.     write("\n\nPress a key"),
  12.     count(0),
  13.     readchar(CH), % The char can be read later than it is detected
  14.     write("\nYou pressed: ",CH),
  15.     loop.
  16.  
  17. GOAL loop.
  18.