B4J Question Should a sub name always start with a capital ?

Steve-h

Member
I found I can call a sub on a different page which has either a lower case or upper case start to the name but only if it is not expecting data.
I can call page2.test or page 2.Test.
However if test is configured to receive a variable it only works if the sub is called Test but not test.

Must sub names start with a Capital or am I missing something?
 

Steve-h

Member
My initial example of Test was misleading and incorrect. However when trying to follow Erel's Qrcode generator example I found that :-

B4X:
Public Sub SetQRstring(s As String)
    ImageView1.SetBitmap(generator.Create("s"))
End Sub

Can be called but :-

B4X:
Public Sub setQRstring(s As String)
    ImageView1.SetBitmap(generator.Create("s"))
End Sub

Can not be called.
Experimenting seems to confirm it is related related to the word Set or set as the beginning of a sub name. Thanks to the pointer on that from Luca
 
Upvote 0

Heuristx

Active Member
Licensed User
Longtime User
My initial example of Test was misleading and incorrect. However when trying to follow Erel's Qrcode generator example I found that :-

B4X:
Public Sub SetQRstring(s As String)
    ImageView1.SetBitmap(generator.Create("s"))
End Sub

Can be called but :-

B4X:
Public Sub setQRstring(s As String)
    ImageView1.SetBitmap(generator.Create("s"))
End Sub

Can not be called.
Experimenting seems to confirm it is related related to the word Set or set as the beginning of a sub name. Thanks to the pointer on that from Luca

No need to experiment:
 
Upvote 0
Top