I would write this sub like this:
sub totalizer { my $number = shift; my $cycle_length = 1; while($number != 1) { $cycle_length++; $number = $number % 2 ? $number * 3 + 1 : $number / 2; } return $cycle_length; }
In reply to Re: General style advice requested
by morgon
in thread General style advice requested
by iangibson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |