Loops/While: Difference between revisions

→‎{{header|Prolog}}: show how to start Prolog execution
(→‎{{header|Prolog}}: clean up Prolog example)
(→‎{{header|Prolog}}: show how to start Prolog execution)
Line 1,129:
<lang prolog>while(0) :- !.
while(X) :-
X > 0,
writeln(X),
X1 is X // 2,
while(X1).</lang>
 
Start the calculation at a top-level like this:
 
<lang prolog>?- while(1024).</lang>
 
=={{header|PureBasic}}==
Anonymous user