Warning: type should be explicit

Cableguy

Expert
Licensed User
Longtime User
I have 3 returns in a sub, that return a string...
Its my knowleage that we don't need to declare the return type for it to work as intented...

B4X:
Return "Continue"

but, just to clarify, how would I declare the return type?
 

stevel05

Expert
Licensed User
Longtime User
Just append As Type to the subroutine name:

B4X:
Sub mysub(Text As String) As String

Dim Result As String

.
.
.
Return Result

End Sub
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Just append As Type to the subroutine name:

B4X:
Sub mysub(Text As String) As String

Dim Result As String

.
.
.
Return Result

End Sub

thanks... actually appending the "as String" to the sub name did it, no need to dim the result inside the sub
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes it would, but I just put it there for completeness.
 
Upvote 0
Top