nataraj: (Default)
[personal profile] nataraj
Читая книжку по внутренностям perl'а открыл для себя оператор `redo` который позволяет повторить выполнение блока кода. В случае если этот блок -- тело цикла, то цикл на следующую итерацию при этом не переходит:

my $i=0;
foreach (1,2,3)
{
  print $_,"\n";
  $i++;
  redo if $i<2;
}

печатает
1
1
2
3


PS так, постойте... В DW был же маркдаун... Куда делася? Не вижу как включить...
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

nataraj: (Default)
Swami Dhyan Nataraj

July 2024

S M T W T F S
 123456
789 10111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 5th, 2025 01:38 pm
Powered by Dreamwidth Studios