Hi all. I have this code:
"Exit" is used to exit (escape) the for-loop, while-loop, switch-statement that you are currently executing and "Return" will exit the entire method you are currently executing (and possibly return a value to the caller, optional). Right ?
In my service i have this code:
When i call "Return" exit second loop but continues on the first.
Any idea ?
Thanks
Marco
B4X:
Sub Button1_Click
Dim i, ii As Int
For i = 0 To 100
DoEvents
Label1.Text = "First Cycle " & i
For ii = 0 To 100
DoEvents
Label2.Text = "Next Cycle " & ii
If i = 1 And ii = 70 Then Return
Next
Next
End Sub
"Exit" is used to exit (escape) the for-loop, while-loop, switch-statement that you are currently executing and "Return" will exit the entire method you are currently executing (and possibly return a value to the caller, optional). Right ?
In my service i have this code:
B4X:
Sub SI_MessageReceived (From As String, Body As String) As Boolean
For i = 0 To ListaAccount.Size -1
'Prelevo Ultimi 4 Caratteri
For ii = 0 to Listaaltro.Size - 1
if xx = "a" then Return
Next
Next
....
When i call "Return" exit second loop but continues on the first.
Any idea ?
Thanks
Marco
Last edited: