Loop 
Author Message
 Loop

I have here an other solution. Compare it with Gorechko solution
and tell me wich is the best.

Predicates

determ horsEchelle(integer,integer) - (i,o)
determ horsEchelle(integer,integer,integer,integer) - (i,i,i,o)

Clauses

horsEchelle(Intx,Resultat) :- horsEchelle(0,Intx,1,Resultat).

horsEchelle(IntX,IntX,ReResultat,ReResultat) :- !.

horsEchelle(IntCompteur,IntX,ReResultatAlt1,ReResultat) :-

IntY=IntCompteur+1,

ReResultatAlt2 = ReResultatAlt1*2,

horsEchelle(IntY,IntX,ReResultatAlt2,ReResultat).

Goal

horsEchelle(10,Resultat).



Fri, 04 Jun 2004 16:46:41 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. break one loop and skip one iteration of outer loop

2. 2 files: a loop within a loop??

3. Problem with loop inside other loop

4. Impelement for loop and do while loop

5. using while loops within while loops?

6. Fast loop inside a slow loop?

7. Troubles using while loops and case loops

8. For Loop looping only once

9. nested while loops, inside loop not stopping correctly

10. For loop, possible to increment counter/exit loop?

11. changing the value of loop-control variable in loop

12. Loop variable value after loop finish

 

 
Powered by phpBB® Forum Software