read(X) reads from input and store it to variable X. write(X) write data to output.
1 ?- read(X).
|: 34
|: .
X = 34
Yes
and
8 ?- write(34).
34
Y es
1
Assert(a) adds a to the knowledge base. retract(a) makes a false.
For example
23 ?- assert(crisis).
Yes
24 ?- crisis
| .
Yes
25 ?- retract(crisis).
Yes
26 ?- crisis.
No