Android Question ResumableSub Type

leitor79

Active Member
Licensed User
Longtime User
Hello!

I've just received the 7.30 update and I've read the changelog and this post, and I still don't get the ResumableSub type advantage/need... I mean, I see the different syntax, but I don't understand what could be achieved with a ResumableSub that couldn't be done without it. I've read comments about lot of ideas or uses, but I don't see the difference between this:

B4X:
Sub Button1_Click
   Wait For(Sum(1, 2)) Complete (Result As Int)
   Log("result: " & Result)
   Log("after sum")
End Sub

and this

B4X:
Sub Button1_Click
   Dim rs As ResumableSub = Sum(1, 2)
   Wait For(rs) Complete (Result As Int)
   Log("result: " & Result)
   Log("after sum")
End Sub

Can anyone give me a tip?


Thank you very much!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm sorry but I previously thought that you are asking about resumable subs in general.

There is no difference between the two code snippets you posted.
Both rely on the new ResumableSub type. The first one gets the ResumableSub object and passes it immediately to Wait For while the second uses a variable to hold the ResumableSub feature.

It was not possible to wait for a resumable sub like this in the previous version.
 
Upvote 0

leitor79

Active Member
Licensed User
Longtime User
Hi Erel, thank you very much for your answer.

Can something be done with the ResumableSub type, besides using it to hold the resumablesub feature?

Thank you!
 
Upvote 0
Top