examples/groovy/early_exit.groovy


if (args.size() < 1) {
    System.exit(42)
}

System.exit(0)

groovy early_exit.groovy
echo $?
42

groovy early_exit.groovy  param
echo $?
0

See also System