Perl continue Statement - Tutorialspoint
文章推薦指數: 80 %
Perl continue Statement, A continue BLOCK, is always executed just before the conditional is about to be evaluated again. A continue statement can be used ... Home CodingGround Jobs Whiteboard Tools Business Teachwithus PerlBasics Perl-Home Perl-Introduction Perl-Environment Perl-SyntaxOverview Perl-DataTypes Perl-Variables Perl-Scalars Perl-Arrays Perl-Hashes Perl-IF...ELSE Perl-Loops Perl-Operators Perl-Date&Time Perl-Subroutines Perl-References Perl-Formats Perl-FileI/O Perl-Directories Perl-ErrorHandling Perl-SpecialVariables Perl-CodingStandard Perl-RegularExpressions Perl-SendingEmail PerlAdvanced Perl-SocketProgramming Perl-ObjectOriented Perl-DatabaseAccess Perl-CGIProgramming Perl-Packages&Modules Perl-ProcessManagement Perl-EmbeddedDocumentation Perl-FunctionsReferences PerlUsefulResources Perl-QuestionsandAnswers Perl-QuickGuide Perl-UsefulResources Perl-Discussion SelectedReading UPSCIASExamsNotes Developer'sBestPractices QuestionsandAnswers EffectiveResumeWriting HRInterviewQuestions ComputerGlossary WhoisWho PerlcontinueStatement Advertisements PreviousPage NextPage PerlOnlineTraining 46Lectures 4.5hours DeviKillada MoreDetail COMPLETEPERLProgramming 11Lectures 1.5hours HarshitSrivastava MoreDetail PerlforBeginners:LearnAtoZofPerlScriptingHands-on 30Lectures 6hours TELCOMAGlobal MoreDetail AcontinueBLOCK,isalwaysexecutedjustbeforetheconditionalisabouttobeevaluatedagain.Acontinuestatementcanbeusedwithwhileandforeachloops.AcontinuestatementcanalsobeusedalonealongwithaBLOCKofcodeinwhichcaseitwillbeassumedasaflowcontrolstatementratherthanafunction. Syntax Thesyntaxforacontinuestatementwithwhileloopisasfollows− while(condition){ statement(s); }continue{ statement(s); } Thesyntaxforacontinuestatementwithforeachloopisasfollows− foreach$a(@listA){ statement(s); }continue{ statement(s); } ThesyntaxforacontinuestatementwithaBLOCKofcodeisasfollows− continue{ statement(s); } Example Thefollowingprogramsimulatesaforloopusingawhileloop− LiveDemo #/usr/local/bin/perl $a=0; while($a<3){ print"Valueofa=$a\n"; }continue{ $a=$a+1; } Thiswouldproducethefollowingresult− Valueofa=0 Valueofa=1 Valueofa=2 Thefollowingprogramshowstheusageofcontinuestatementwithforeachloop− LiveDemo #/usr/local/bin/perl @list=(1,2,3,4,5); foreach$a(@list){ print"Valueofa=$a\n"; }continue{ lastif$a==4; } Thiswouldproducethefollowingresult− Valueofa=1 Valueofa=2 Valueofa=3 Valueofa=4 perl_loops.htm PreviousPage PrintPage NextPage Advertisements
延伸文章資訊
- 1Perl continue流控制
定义和用法. continue 实际上是一个流控制语句而不是函数。如果有一个continueBLOCK连接到一个BLOCK(通常是在while或foreach),它将始终被执行之前的条件再次进行...
- 2Perl next Statement - Tutorialspoint
The Perl next statement starts the next iteration of the loop. You can provide a LABEL with next ...
- 3Perl continue 語句 - W3big
Perl continue 塊通常在條件語句再次判斷前執行。 continue 語句可用在while 和foreach 循環中。 語法. while 循環中continue 語句語法格式如下所示...
- 4Perl的基本語法
Perl也有和C語言的break和continue一樣的指令,Perl叫它做last 和next (較口語化)。 # last是跳出現在所在的迴圈,next則是跳過下面的指令直接執行下一次的迴圈。
- 5Perl continue 语句 - 简单教程
Perl 中的**continue** 语句用于停止执行从continue 语句的下一语句开始到循环体结束标识符之间的语句,返回到循环体的起始处开始执行下一次循环continue 语句可用 ...