Version 2.20 Variable Default Assignment Problem

Azlan

Member
Licensed User
Longtime User
B4X:
Dim temp1 As String ="hello" & "," & "hello"

Will generate error:

Compiling code. Error
Error parsing program.
Error description: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Occurred on line: 1267
Dim temp2 As String ="hello" & "," & "hello"

Whereas:
B4X:
Dim temp1 As String ="hello" & ", " & "hello"

Will compile Ok, a space after the comma.

Likewise the following will generate an error

B4X:
Dim v1, v2 As Int = 0

Dim temp1 As String = "test(" & v1 & "," & v2  & ")"

Compiling code. Error
Error parsing program.
Error description: Unknown type: &
Are you missing a library reference?
Occurred on line: 1267
Dim temp1 As String = "test(" & v1 & "," & v2 & ")"

and

B4X:
Dim temp1 As String = "test(" & v1 & ", " & v2  & ")"

is ok, space after the comma.

If assigned like this no problem

B4X:
Dim temp1 As String  : temp1 = "test(" & v1 & "," & v2  & ")"

Cheers.
 

Azlan

Member
Licensed User
Longtime User
Hi Erel,

No problem.

If you want, put us on your beta tester list as we are using B4A pretty much all the time.

Cheers.
 
Top