But what I was trying to do is to find the smallest number in a certain range satisfying some condition and then go on using that found value.
Doing it like
Looked (at the time) to be a straightforward solution and I was suprised that it did not work.my $i; for $i (1..10) { last if &condition($i); } &do_more_stuff_with_the_value_found($i);
This is just for explaining where this comes from (I am not a really good programmer I am afraid...)
And even accepting that this is not the way to do it (there are of course many other ways), it is neverthless surprising that this actually does work:
This is to my eyes at least an inconsistency (and thus a wart). But whatever, this is how it was, is and will be...my $i; for ($i=1; $i<=10; $i) { last if &condition($i); } &do_more_stuff_with_the_value_found($i);
In reply to Re^6: loop surprise
by morgon
in thread loop surprise
by morgon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |