On Wed, Apr 27, 2005 at 11:48:39PM -0500, David Nicol wrote:
> You want to go from n to m by tens, presumably you have
> taken introductory C programming at some point in grade school
> or somewhen, you do not need coaching to come up with
> 
>       for (my $num = $n; $n <= $m; $n+= 10){

Not to put too fine a point on it...

  my $m = 100;
  for (my $num = $n; $n <= $m; $n+= 10){
      print "$num\n";
  }

prints all zeros and a few uninit warnings.  I think you meant

  my $max = 100;
  for( my $num = 0;  $num <= $max;  $num += 10 ) {
     print "$num\n";
  }

which is a mistake one does not need coaching to come up with when using
C-style for loops.

Reply via email to