Re: for loop in prolog
- From: Guybrush Threepwood <spambak@xxxxxxxxxxx>
- Date: Tue, 10 Jan 2006 21:07:41 +0000
On Tue, 10 Jan 2006 21:29:20 +0200, nobody wrote:
> hi to all,
>
> How could i implement a for loop in prolog. Let's say for
> example that i have an integer variable X and i want to repeat X times a
> specific action. Any idea welcome...
I'm a beginner myself, but I think it would be something like this:
do_n_times(0):- !.
do_n_times(N):-
%do actions,
NewN is N-1,
do_n_times(NewN).
--
"Don't worry about people stealing your ideas. If your ideas are any
good, you'll have to ram them down people's throats."
-- Howard Aiken
.
- References:
- for loop in prolog
- From: nobody
- for loop in prolog
- Prev by Date: for loop in prolog
- Next by Date: http_open vs. http_get using proxy
- Previous by thread: for loop in prolog
- Next by thread: Re: for loop in prolog
- Index(es):
Relevant Pages
|
|