Android Question Equivalent of Try and Finally

walterf25

Expert
Licensed User
Longtime User
Hello all, I was wondering if there's something equivalent to the Java Try and Finally, I know there's Try and Catch, but i don't think they are the same, as the Try and Finally executes whatever is inside the Finally part regardless of what the result of the code inside the Try part is, is there anything like this in B4A?

Thanks,
Walter
 

emexes

Expert
Licensed User
The code immediately after the End Try is executed regardless of what happened inside the Try-Catch (except for oddball cases like hard errors and Sub Returns).

If you have some specific sequencing requirements, then you can set a flag in the Catch block, and use it to interleave your recovery and cleanup code after the End Try in whatever order is required.
 
Upvote 0
Top