why I can't use `return` in `kts` scripts?
# scripting
s
why I can't use
return
in
kts
scripts?
g
Top level return? Why do you need this?
o
Early script exit? Sounds reasonable
e.g. “File not found script.config” and that’s it
g
Yeah, early return can make sense but maybe better to use exitProcess, also it allows to return status code
o
exitProcess
doesn’t allow to call scripts from other scripts
g
interesting. Make sense for such case
s
Copy code
if (!file.exists()) {
        println("no such file")
        return
    }
    //continue
g
Yeah. If it's standalone script you can use exitProcess for now