0

I am working with Turbo prolog Dynamic DataBase. So here is my database making as well as free variable error containing code.

domains
song = song(songName,songGenre,songRelease,singerName,likes,dislikes)
movie = movie(movieName,releaseDate,movieGenre,leadActor,leadActress,director,ratings)

database
project(song,movie)

And the error code is :-


admin(1):-
write("Enter Song Name :"),readln(A),
write("Enter Song Genre :"),readln(B),
write("Enter Release Date :"),readln(C),
write("Enter Singer Name :"),readln(D),
write("Enter Likes :"),readreal(E),
write("Enter DisLikes :"),readreal(F),
%next line gives me the error
assertz(project(song(A,B,C,D,E,F),movie(_,_,_,_,_,_,_))),
save("project.txt").
admin(1).

So if anyone can help

rajashekar
  • 3,460
  • 11
  • 27
  • assertz gives the error that free variable not allowed but I have defined in my database section shown above – Prashant Aghara Oct 07 '21 at 07:07
  • In `movie(_,_,_,_,_,_,_)` each of the `_` is a free variable. If you want to assert a relation between a song and a movie, the movie's data must be known as well. – Isabelle Newbie Oct 21 '21 at 19:22

0 Answers0