Help for this page

Select Code to Download


  1. or download this
    This slightly more ornate example adds up the elements of an array:
    
            sum = 0;
            for( i=0; i<n; i++)
                   sum = sum + array[i];
    
  2. or download this
      For Loops
           Perl's C-style "for" loop works like the corresponding "while" 
    +loop;
    ...
               } continue {
                   $i++;
               }