tsteward Well-Known Member Licensed User Longtime User Jun 19, 2025 #1 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
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
LucaMs Expert Licensed User Longtime User Jun 19, 2025 #2 tsteward said: v = GetAssetDBVersion() Click to expand... Just remove the parentheses from the call. Upvote 0
E emexes Expert Licensed User Longtime User Jun 19, 2025 #3 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: Jun 19, 2025 Upvote 0
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
tsteward Well-Known Member Licensed User Longtime User Jun 19, 2025 #4 Thanks heaps guys, the simplest thing and I should know better Upvote 0