Question: I am trying to write prolog code from my notepad and run it on SWI-Prolog (the owl icon). except when I try to run it,
I am trying to write prolog code from my notepad and run it on SWI-Prolog (the owl icon). except when I try to run it, it spits out an error.
this is the code on notepad: guess_num :- loop(start).
loop(15) :-('you guessed it).
loop(X) :- X\= 15, write('guess number '), write(' is not the number, try again'), nl, read(Guess), write(Guess), loop(Guess).
then when I try and run it in SWI, I press File > Consult, and open my .pl (notepad) file from the file explorer. It compiles without error.
when I type 'guess_num.' to try and run the loop it says error: unknown procedure
does anyone know what is happening and how I can fix it?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
