while  ( fl -- )

publication: 18 janvier 2022 / mis à jour 16 février 2022

Read this page in english

 

Marque la partie d'exécution conditionnelle d'une structure begin..while..repeat

Exemple:

\ logarithmus dualis of n1>0, rounded down to the next integer 
: log2 ( +n1 -- n2 ) 
    2/ 0 begin 
        over 0 >  
    while 
        1+ swap 2/ swap 
    repeat 
    nip  
  ; 
  7 log2 .     \ display 2 
100 log2 .     \ display 6 

Legal: site web personnel sans commerce / personal site without seling