Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a variable empty in Prolog?

Tags:

prolog

I want to empty a used variable in Prolog. For example, I want to do like this:

i = null;

but in Prolog.

How do I do this?

like image 265
question Avatar asked Nov 24 '25 14:11

question


1 Answers

You cannot do that with pure prolog variables; once a variable is instantiated its value cannot change.

You could use global variables, but I strongly recommend to try to think a less imperative way to write the program.

edit: check DaveEdelstein's comment too

like image 176
Thanos Tintinidis Avatar answered Nov 28 '25 17:11

Thanos Tintinidis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!