OF  ( n -- )

published: 8 November 2022 / updated 8 November 2022

Lire cette page en français

 

vocabulary: forth

Marks a OF .. ENDOF choice in the control structure between CASE ENDCASE

If the tested value is equal to the one preceding OF, the part of code located between OF ENDOF will be executed.

Example:

: day ( n -- addr len ) 
    CASE 
        0 OF s" Sunday"     ENDOF 
        1 OF s" Monday"     ENDOF 
        2 OF s" Tuesday"    ENDOF 
        3 OF s" Wednesday"  ENDOF 
        4 OF s" Thursday"   ENDOF 
        5 OF s" Friday"     ENDOF 
        6 OF s" Saturday"   ENDOF 
    ENDCASE 
  ; 

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