Swift: using multiple try-catch blocks

Hi,
I have to write a function that needs to call 3 or 4 "try" statements one after the other. I'm not sure what the right syntax for this is. Basically, something like this:

Code Block
do {
try blah()
} catch {
...
}
do {
try blah2()
} catch {
...
}



What happens if the first 'try' failed? Does it keep going, and call the 2nd block?

Also, does it make sense to call multiple 'try' statements within the same 'do' block instead?

Thanks.
Answered by OOPer in 628493022

Does it keep going, and call the 2nd block?

YES.

Also, does it make sense to call multiple 'try' statements within the same 'do' block instead?

YES. A very common usage.
Accepted Answer

Does it keep going, and call the 2nd block?

YES.

Also, does it make sense to call multiple 'try' statements within the same 'do' block instead?

YES. A very common usage.
Swift: using multiple try-catch blocks
 
 
Q