Perl last Function - Tutorialspoint
文章推薦指數: 80 %
Perl last Function, This is not a function. The last keyword is a loop-control statement that immediately causes the current iteration of a loop to become ... 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 PerllastFunction Advertisements PreviousPage NextPage PerlOnlineTraining 46Lectures 4.5hours DeviKillada MoreDetail COMPLETEPERLProgramming 11Lectures 1.5hours HarshitSrivastava MoreDetail PerlforBeginners:LearnAtoZofPerlScriptingHands-on 30Lectures 6hours TELCOMAGlobal MoreDetail Description Thisisnotafunction.Thelastkeywordisaloop-controlstatementthatimmediatelycausesthecurrentiterationofalooptobecomethelast.Nofurtherstatementsareexecuted,andtheloopends.IfLABELisspecified,thenitdropsoutoftheloopidentifiedbyLABELinsteadofthecurrentlyenclosingloop. Syntax Followingisthesimplesyntaxforthisfunction− lastLABEL last ReturnValue Thisdoesnotreturnanyvalue. Example Followingistheexamplecodeshowingitsbasicusage− LiveDemo #!/usr/bin/perl $count=0; while(1){ $count=$count+1; if($count>4){ print"Goingtoexistoutoftheloop\n"; last; }else{ print"Countis$count\n"; } } print"Outoftheloop\n"; Whenabovecodeisexecuted,itproducesthefollowingresult− Countis1 Countis2 Countis3 Countis4 Goingtoexistoutoftheloop Outoftheloop perl_function_references.htm PreviousPage PrintPage NextPage Advertisements
延伸文章資訊
- 15.7 迴圈控制
Perl 常見的迴圈有while、for、foreach、until,在每一種迴圈中,可以視情況,使用以下三種算符,來控制迴圈。 last 一次只能跳出一層迴圈語法:last 用例: $i=0;...
- 2Perl last關鍵字 - 極客書
定義和用法. 不是一個函數。last關鍵字立即使循環當前迭代,成為最後一個循環控製語句。冇有進一步的語句被執行,並結束循環。如果指定LABEL,然後它丟棄循環的識 ...
- 3Perl last关键字 - 极客书
perl last 关键字学习例子,last实例代码,在线教程等. ... 不是一个函数。last关键字立即使循环当前迭代,成为最后一个循环控制语句。没有进一步的语句被执行,并结束 ...
- 4精簡扼要的Perl 課程講義(三):迴圈與控制結構 - G. T. Wang
next 跳到這裡 } # last 跳到這裡繼續執行 # 註:next, last 與redo 皆可用在for,foreach,while 與until 等迴圈。 # (7) if # (A)...
- 5Perl last 语句 - 菜鸟教程
Perl last 语句Perl 循环Perl last 语句用于退出循环语句块,从而结束循环,last语句之后的语句不再执行,continue语句块也不再执行。 语法语法格式如下所示: las...