Hi guys, In a non UI database, I have a codes like these Sub Process_Globals Private pool As ConnectionPool Private Tm As Timer End Sub Sub AppStart (Args() As String) pool.Initialize(....) Tm.Initialize("TM",3000) Tm.Enabled = True Try...
But if you still really want to try this quantum duality approach to programming, you could use Sleep(0) instead of Return to harness the magic of resumable subs.
Meaning everytime I need to close the connection before using Return?
B4X:
Sub Foo
Dim sql As SQL = pool.GetConnection
Try
If some_condition = True Then
sql.Close
Return
End If
'work with sql
Catch
'handle failure
End Try
sql.Close
End Sub
Sub Foo
Dim sql As SQL = pool.GetConnection
Try
If some_condition = False Then
‘Do your processing
'work with sql
End If
Catch
'handle failure
End Try
sql.Close
End Sub
No extra return needed that complicates everything
edit: fixed semantics of code
edit2: should not be on my phone
Sub Foo
Dim sql As SQL = pool.GetConnection
Try
If some_condition = False Then
‘Do your processing
'work with sql
End If
'work with sql
Catch
'handle failure
End Try
sql.Close
End Sub
No extra return needed that complicates everything