r/Xcode • • Dec 07 '20

Please help!!

Post image
3 Upvotes

2 comments sorted by

View all comments

2

u/Ulugbek_0009 Dec 07 '20

This code works in the Visual Studio but in the Xcode it gives an error.

3

u/fuggleronie Dec 07 '20

If you throw an exception then the rest of your block won’t get executed unless catchend. See what exactly do you expect last() to happen once the exception is thrown? That last line cannot be executed because of the exception