?- A is 10-2, write(A).
8
A = 8.
%or
?- use_module(library(clpfd)).
true.
?- A #= 10-2, write(A).
8
A = 8.
%this lets you do the other thing too
?- 8 #= A-2, write(A).
10
A = 10.
foreach doesn't really work the way you want it though, in this case you want forall.
?- forall(between(0,5,N), (A is 5-N,writeln(A))).
5
4
3
2
1
0
true.
Comments
arithmetic is evaluated by 'is'
foreach doesn't really work the way you want it though, in this case you want forall.Wow... ok... I can calm down a bit... thanks for the help!