Break

break
last

1 PHP[ | ]

$arr = array(1, 2, 3, 4, 5);
while (list(, $val) = each($arr)) {
    if ($val == 3) break;
    echo "$val<br />\n";
}
// 1
// 2

2 Python[ | ]

nums = [1, 2, 3, 4, 5]
for num in nums:
    if num > 2:
        break
    print( num )
# 1
# 2

3 Perl[ | ]

my @nums = (1, 2, 3, 4, 5);
foreach my $num (@nums) {
	if ( $num > 2 ) {
		last;
	}
	printf("$num\n");
}
# 1
# 2

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}