开发者

What do Groovy assertions look like with parentheses?

开发者 https://www.devze.com 2022-12-21 07:22 出处:网络
The example on this page only shows Groovy assertion开发者_开发问答s without parentheses. assert a != null, \'First parameter must not be null\'

The example on this page only shows Groovy assertion开发者_开发问答s without parentheses.

assert a != null, 'First parameter must not be null'

What would this look like if I wanted to include the parentheses? I presume that this is the closest equivalent to Perl's die() function (print error message and exit in one statement)?


The answer is:

assert(a != null), "First parameter must not be null"
0

精彩评论

暂无评论...
验证码 换一张
取 消