mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[perl/en] more perlish iterations on perl5 (#2489)
* more perlish iteration c-style 'for' isn't perlish * Update perl.html.markdown removed one of the array iterator loops
This commit is contained in:
parent
4e6d077556
commit
447986c19d
@ -138,18 +138,16 @@ while (condition) {
|
||||
|
||||
|
||||
# for loops and iteration
|
||||
for (my $i = 0; $i < $max; $i++) {
|
||||
for my $i (0 .. $max) {
|
||||
print "index is $i";
|
||||
}
|
||||
|
||||
for (my $i = 0; $i < @elements; $i++) {
|
||||
print "Current element is " . $elements[$i];
|
||||
}
|
||||
|
||||
for my $element (@elements) {
|
||||
print $element;
|
||||
}
|
||||
|
||||
map {print} @elements;
|
||||
|
||||
# implicitly
|
||||
|
||||
for (@elements) {
|
||||
|
Loading…
Reference in New Issue
Block a user