if ($food) { print "$food\n"; eat (substr($food,0,length($food)-1)); }
Yes recursion can be instructive, but be careful not to mismatch a conditional test with the logical intent of the test. Your test of true or false doesn't mesh with your logical intent of recursing based on the length of the string. Try eating the string "012345" and your recursion ends too early because a string can have a non-zero length and still be false.
In reply to Re: (jeffa) Re: permutation understanding
by Anonymous Monk
in thread permutation understanding
by Parham
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |