How to use user input in prolog for search

hi, I want to be able to enter a user and then store it and use it in my code.

body(mercury, 36, small, none, none). body(venus, 67, small, atmosphere, none). body(earth, 93, small, atmosphere, none). body(moon, 93, small, none, none). body(mars, 141, small, atmosphere, none). body(jupiter, 489, large, atmosphere, rings). miles(Body,Miles):-write('Enter the Goal State:'),nl, read(X),nl, body(Body, Miles, _, _, _); Miles > X. 
0
variables input testing prolog
source share
1 answer

i first switched to the GNU prologue, which helped.

  miles(Body,Miles):-write('Enter the Goal State:'),nl, read(X),nl, body(Body, Miles, _, _, _), Miles > X. 
0
source share

All Articles