February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
Resumes the next iteration of the enclosing for, while, until, or select loop.
Syntax
continue[n]
Options
None
Oddities
If n is specified, it resumes at the nth enclosing loop.
Example
$ cat buzz3 #! /bin/ksh integer x=17 while (( x<25 )) do x=x+1 if (( x==21 )) then print "x>20" continue # Prints message when x=21, # then continues the loop fi done print $x $ $ buzz3 x>20 25 # Note that x contains 25, # proving that the loop finished $ $ $ cat buzz4 # Contains nested loops #! /bin/ksh integer x=17 integer y=0 for (( y=0; y<5; y++ )) do while (( x<25 )) do x=x+1 if (( x=21 )) then continue 2 # Ends this pass through inner loop, # but continues outer loop fi done done print $x print $y $ $ buzz4 21 5 # Note that ...
Read now
Unlock full access