Jump to content
Sign in to follow this  
dpmancus

array troble

Recommended Posts

dpmancus

hi everybody,

got a problem with array definition:

here's my array definition

$s[1] = "qwerty"

on running i reiceve an error:

Line 13 (File "C:\Documents and Settings\Antony\Documenti\AutoIT prove\Nuovo AutoIt v3 Script (2).au3"):

$s[1] = "qwerty"

$s^ ERROR

Error: Expected a "=" operator in assignment statement.

where is my mistakes?????

thanks

Edited by dpmancus

Share this post


Link to post
Share on other sites
PsaltyDS

; 1D Arrays:
Global $s[1] = ["qwerty"]
Global $t[2] = ["qwerty", "dvorak"]

;2D Array:
Global $u[2][2] = [["0/0", "0/1"], ["1/0", "1/1"]]

; 3D Array:
Global $v[2][2][3] = [[["0/0/0", "0/0/1", "0/0/2"], ["0/1/0", "0/1/1", "0/1/2"]], [["1/0/0", "1/0/1", "1/0/2"], ["1/1/0", "1/1/1", "1/1/2"]]]

:)

Edit: Forgot variable declaration keyword (Dim/Local/Global). This syntax for initializing the array is only valid when the array is declared.

:idea:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dpmancus

s[1] = "qwerty" is line n°13

:idea:

Posted Image

Share this post


Link to post
Share on other sites
dpmancus

; 1D Arrays:
$s[1] = ["qwerty"]
$t[2] = ["qwerty", "dvorak"]

;2D Array:
$u[2][2] = [["0/0", "0/1"], ["1/0", "1/1"]]

; 3D Array:
$v[2][2][3] = [[["0/0/0", "0/0/1", "0/0/2"], ["0/1/0", "0/1/1", "0/1/2"]], [["1/0/0", "1/0/1", "1/0/2"], ["1/1/0", "1/1/1", "1/1/2"]]]

:)

thanks a lot... i'll try this way

:idea:

Share this post


Link to post
Share on other sites
Malkey

This script when run, does not create any errors.

Local $s[2] 

$s[1] = "qwerty"

;==============================

; 1D Arrays:
Local $s[1] = ["qwerty"]
Global $t[2] = ["qwerty", "dvorak"]

;2D Array:
Dim $u[2][2] = [["0/0", "0/1"],["1/0", "1/1"]]

; 3D Array:
Local $v[2][2][3] = [[["0/0/0", "0/0/1", "0/0/2"],["0/1/0", "0/1/1", "0/1/2"]],[["1/0/0", "1/0/1", "1/0/2"],["1/1/0", "1/1/1", "1/1/2"]]]

Share this post


Link to post
Share on other sites
PsaltyDS

This script when run, does not create any errors.

Oops. I forgot the declaration keywords. Fixed in original post.

:idea:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
dpmancus

thanks... now it's ok

i was forgetting "Dim $s[2]"!!!! :idea::):(

got to study more :)

Share this post


Link to post
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
Sign in to follow this  

×