Jump to content

Array assignment


Recommended Posts

Hello!

Can anyone explain what's going on here:

; Initializing an array
Local $a = [ 0 ]

; Lately in code I want to assign new array to $a variable
$a = [ 1 ]

and got this error at compile time

==> Error in expression.:
$a = [ 1 ]
$a = ^ ERROR

What is it and why?

And I've mentioned that I can't pass "manual" array to function as parameter:

a( [ 0 ] )

Func a( $a )
    _ArrayDisplay( $a )
EndFunc

still the same error

==> Error in expression.:
a( [ 0 ] )
a( ^ ERROR

 

Link to comment
Share on other sites

just declare it

local $a

and when you know the dimensions, just do

dim $a[$knownscope] [$anotherscope]

The reason for your function not knowing its an array is because you did not declare it properly before you called it.

 

Edited by aiter
more detail
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...