I am writing an automation script that takes an input X. I lookup X in a table, and then go on and do stuff with what I've found.
But if the lookup comes up empty, (no qualifying records), I want to exit the script. I could do this:
if (X was not found in table) {
output.set("error", `${X} was not found`)
} else {
// do stuff
}
But this gets messy. If I need to lookup X, and then Y, and then Z, then each additional lookup results in more indentation of my code. What I'd like to do is this:
if (X was not found in table) {
return from script
}
"return" isn't allowed. Googling has not provided an answer.
Is there any way to do what I want?