Like this:
my $x=0; my $size=5; for( my $i=0; $i<$size; $i+=2,$x++ ) { print "$i:$x\n"; }
or
my $x=0; my $size=5; for( my $i=0; $i<$size; $i+=2 ) { print "$i:",$x++,"\n"; }
In reply to Re: Increment by 2 and by 1 in same loop.
by hdb
in thread Increment by 2 and by 1 in same loop.
by freekngeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |