B4J Question Redim array

rameshb

Member
Hi all,

When i want to redim array (using dim with new dimension),do i need to specify its type again?

When i didnt specify the type i redim ,it is taking as string type

and showing error as previous declaration type do not match.
 

LucaMs

Expert
Licensed User
Longtime User
I have noticed one thing to point out (I used B4A but certainly it is the same).

I have declared an array of strings without its size in Globals ( Private mArr() )

I was able to resize the array inside a routine using Dim but also Private.
This means that you can not have two arrays with the same name, one global and one local.

In addition, if a function return as a result an array of the same type, it can automatically resize the array.

mArr = ReturnsAnArrayOfString

Sub ReturnsAnArrayOfString As String()
End Sub
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Compiler, a little bit different case
upload_2014-11-5_13-58-18.png
 
Upvote 0
Top