Coming from a Delphi background, I was surprised not to find a Try/Finally block. Even SQL scripting languages have Begin/Finally blocks.
I use this a lot to ensure code is always executed even if an exception occurs so I can close files or clean up loose ends before the rtn is exited. I know there is a Try/Catch block but that only gets executed during an exception.
Try
'Execute code here like opening files, executing HTTP etc..
Finally
'This code always gets executed even if there is an exception in the above block of code
End
I'd certainly like to see this added to a future version of B4x. It would make for more stable programs.
I use this a lot to ensure code is always executed even if an exception occurs so I can close files or clean up loose ends before the rtn is exited. I know there is a Try/Catch block but that only gets executed during an exception.
Try
'Execute code here like opening files, executing HTTP etc..
Finally
'This code always gets executed even if there is an exception in the above block of code
End
I'd certainly like to see this added to a future version of B4x. It would make for more stable programs.