home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / EXAMPLES.ARC / CH05EX14.PRO < prev    next >
Encoding:
Prolog Source  |  1988-06-21  |  504 b   |  28 lines

  1. /*
  2.    Turbo Prolog 2.0 Chapter 5, Example Program 14
  3.    
  4.    Copyright (c) 1986, 88 by Borland International, Inc
  5.    
  6. */
  7.  
  8. predicates
  9.    action(integer)
  10.  
  11. clauses
  12.    action(1) :- !,
  13.       write("You typed 1.").
  14.  
  15.    action(2) :- !,
  16.       write("You typed two.").
  17.  
  18.    action(3) :- !,
  19.       write("Three was what you typed.").
  20.  
  21.    action(_) :- !,
  22.       write("I don't know that number!").
  23.  
  24. goal
  25.    write("Type a number from 1 to 3: "),
  26.    readreal(Choice), 
  27.    action(Choice).   
  28.