$$$$ REPE NOTICE GOUNAND 26/01/16 21:15:14 12451 DATE 26/01/16 Directive REPETER Voir aussi : ITER QUIT ----------------- FIN ENUM REPETER BLOC1 | (N1) | ; | (LISTOBJ1) | Section : Langage Base FRAN========================================================== Objet : _______ L'objet BLOC1 (de type BLOC) est constitue de l'ensemble des instructions comprises entre la directive REPETER BLOC1 et la directive FIN BLOC1. La directive REPETER permet de repeter plusieurs fois l'execution de cet ensemble d'instructions. Si l'entier N1 est specifie, il faut le mettre apres le nom de la boucle, et la boucle est repetee N1 fois. Un objet ENTIER s'appelant &BLOC1 est incremente a chaque iteration (compteur de boucle valant 1 lors du premier passage). Si une liste d'objets LISTOBJ1 est specifiee, la boucle est repetee pour chaque objet de la liste, et le nom &BLOC1 permet d'acceder a cet objet. ATTENTION : seules les 7 premieres lettres du nom BLOC1 sont mises _________ derriere le caractere &. Remarque : __________ Si N1 est nul, le code de la boucle n'est jamais execute. Si N1 est negatif, la repetition se fait indefiniment. Si N1 et LISTOBJ1 ne sont pas specifies, la repetition se fait indefiniment. Il est possible dans tous les cas d'interrompre la repetition a l'aide de la directive QUITTER. L'instruction ITERER permet quant a elle de passer directement a l'iteration suivante, sans executer le reste du code present jusqu'a la fin du bloc. Exemple : _________ I=0 ; CRIT= 1E-5; CRITM= CRIT*-1; C=0. ; EPS1= 0 ; OK = FAUX ; REPETER BLOTO 100 ; I = I + 1; C = C + (1./ I) ; EPS = C - (LOG I) ; D = EPS - EPS1 ; SI ( (D < CRIT) ET (D > CRITM) ) ; OK = VRAI ; MESS 'Constante d''Euler calculee en' &BLOTO ' iterations' ; QUITTER BLOTO ; FINSI ; EPS1 = EPS ; FIN BLOTO ; SI OK ; LIST EPS ; SINON ; MESSAGE 'Non convergence' ; FINSI ; FIN; ANGL========================================================== Description : _____________ The BLOC1 object (BLOC type) is composed of the set of instructions comprised between the REPETER BLOC1 instruction and the FIN BLOC1 instruction. The REPETER instruction enables the user to repeat several times the execution of this set of instructions. If the integer N1 (ENTIER type) is specified, it must be given after the loop name, and the loop is repeated N1 times. An ENTIER object called &BLOC1 is automatically defined and incremented at each iteration (loop counter equal to 1 for the first iteration). If the object list LISTOBJ1 is specified, the loop is repeated for each object in the list, and the name &BLOC1 gives access to that object. WARNING : only the seven first letters of BLOC1 are taken into ________ account and put after the & character. Note : ______ If N1 is zero, the loop code is not executed. If N1 is negative, the loop is infinite. If neither N1 nor LISTOBJ1 are specified, the loop is infinite. It is possible to stop the loop by means of the QUITTER instruction. The ITERER instruction allows to go directly to the next iteration, skipping the remaining instructions of the block. Example : _________ * Euler's constant computation * ============================ I=0 ; CRIT= 1E-5; CRITM= CRIT*-1; C=0. ; EPS1= 0 ; OK = FAUX ; REPETER BLOTO 100 ; I = I + 1; C = C + (1./ I) ; EPS = C - (LOG I) ; D = EPS - EPS1 ; SI ( (D < CRIT) ET (D > CRITM) ) ; OK = VRAI ; MESS 'Euler constant computed in' &BLOTO ' iterations' ; QUITTER BLOTO ; FINSI ; EPS1 = EPS ; FIN BLOTO ; SI OK ; LIST EPS ; SINON ; MESSAGE 'Computation failed' ; FINSI ; FIN;