Assert

assert
die

1 Python[ | ]

assert 1 == 1
assert 1 == 2
# AssertionError
assert 1 == 2, 'Oh, my goodness.'
# AssertionError: Oh, my goodness.

2 Perl[ | ]

die unless 1 eq 1;
die unless 1 eq 2;
# Died at - line 2
die("Oh, my goodness.") unless 1 eq 2;
# Oh, my goodness. at - line 1.
use Carp::Assert;
assert(1 eq 2);
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}