fac(0,1).
fac(X,Y):-
X>0,
X1 is X-1,
fac(X1,N),
Y is N*X.
I understand how recursion works in java but now im just starting with prolog and I have trouble understanding how N changes for each time fac is called?
fac(0,1).
fac(X,Y):-
X>0,
X1 is X-1,
fac(X1,N),
Y is N*X.
I understand how recursion works in java but now im just starting with prolog and I have trouble understanding how N changes for each time fac is called?