... once you add code to remember the index for use after the loop -- and omit the say ...
Sure, but that's different than the code JavaFan posted. If I were to write code to save the index after the loop, I'd write it more like the code you wrote (minus the potential infinite loop) or with something from one of the List::*Util family, like other people wrote.
Even so, it's still less synthetic once you count tokens and the possibility of writing the wrong code.
In reply to Re^6: Finding the index of a specific element in an array.
by chromatic
in thread Finding the index of a specific element in an array.
by Thakur
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |