Programming Tutorials

(追記) (追記ここまで)

break in Mac OS X

By: Strauss K in macos Tutorials on 2011年02月03日 [フレーム]

Exit from afor,while, untilorselectloop.

Syntax
 break [n]

Ifnis specified, breaknlevels.

n must be >= 1. If n is greater than the number of enclosing loops, all enclosing loops are exited.

The return value is 0 unless the shell is not executing a loop when break is executed.

Example

for i in 1 2 3 4 5
do echo -n "Hello World${i} "
 if [ "$i" -eq 3 ] 
 then 
 break # This line will break out of the loop
 fi
done

break is a builtin command.




(追記) (追記ここまで)


Add Comment

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /