In Perl:
foreach my $word (qw(this that whatever))
{
dosomething($word);
}
In PL/SQL:
<<foreach>>
DECLARE
TYPE wordlist_t IS VARRAY(somenumber) OF
VARCHAR2(#);
wordlist wordlist_t
:= wordlist_t('this', 'that', 'whatever');
BEGIN
FOR i IN wordlist.FIRST.. wordlist.LAST
LOOP
dosomething(wordlist(i));
END LOOP;
END foreach;
Or even... (Score:3, Funny)
--
xoa
Reply to This
Re:Or even... (Score:2)
Hmm, yeah, but usually I use the other form because I'm thinking of traversing the list. However, maybe that would read more naturally.
BTW, did I fail to get the joke? What's funny?
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
But if your array is zero... (Score:2)
This fails if your array has zero size.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers