Jump to content

array troble


Recommended Posts

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
Link to comment
Share on other sites

; 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
Link to comment
Share on other sites

; 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:

Link to comment
Share on other sites

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"]]]
Link to comment
Share on other sites

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
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...