Android Question Array Expected?

tsteward

Well-Known Member
Licensed User
Longtime User
In the following minimalist code line 7 the IDE gives an error of Array Expected but I don't understand why.
B4X: Copy
Sub Class_Globals
    Private SQL1 As SQL
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Dim v As Int
    v = GetAssetDBVersion()
    Log("Version: " & v)
End Sub

Private Sub GetAssetDBVersion As Int
    Return 42
End Sub
 
I minimalised it even further to a B4J console program:

B4X: Copy
Sub Process_Globals
End Sub

Sub AppStart (Args() As String)
    Dim v As Int
    v = GetAssetDBVersion()
    Log("Version: " & v)
End Sub

Private Sub GetAssetDBVersion As Int
    Return 42
End Sub

which still has the same array expected message, and since clearly the answer 42 is correct, then the problem must be the superfluous parentheses of line 6, as @LucaMs beat me to by seconds minutes. 🍻

Code: Copy
Version: 42
 
Last edited:
Upvote 0
Back
Top