in reply to Best way to make sure a number is an even multiple of another?

Cheat, no if():
sub fix{ my ($n,$m)=@_; my $M = $n % $m; $M && return $n + $m - $M; $n; }

C.

  • Comment on Re: Best way to make sure a number is an even multiple of another?
  • Download Code