I want to exit from inside a try block:
function myfunc
{
try {
# Some things
if(condition) { 'I want to go to the end of the function' }
# Some other things
}
catch {
'Whoop!'
}
# Other statements here
return $whatever
}
I tested with a break, but this doesn’t work. It breaks the upper loop if any calling code is inside a loop.
An extra scriptblock around
try/catchand thereturnin it may do this: