Jump to content
Sign in to follow this  
nht3004

About Array!

Recommended Posts

nht3004

How can I start an array without the size of that?

Global key[3];

Key[1]="Hello";

Key[2]="Hi";

The red one is the one I want to skip!

And how can I get array size for For...To...Step...Next work?

Example

For $i=0 To sizeOfArrayThatIUsedToUse$Array[0] Step 1

Next

Edited by nht3004

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites
LurchMan

How can I start an array without the size of that?

Global key[3];

Key[1]="Hello";

Key[2]="Hi";

The red one is the one I want to skip!

Global Key

Then define what each dimension of the array is or use some UDF or something that returns an array...always works for me, dunno if thats the way your suppose to do it though.

and for array size:

For $n = 0 To UBound($Array) - 1
;do something
Next
Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
nht3004

Global Key

Then define what each dimension of the array is or use some UDF or something that returns an array...always works for me, dunno if thats the way your suppose to do it though.

I dont' get what you mean ^_^ , could u show me details?

Thanks!


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites
LurchMan

read this: Arrays

Then look in the help file about _FileListToArray() those 2 things will help you


Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
nht3004

Global Key

Then define what each dimension of the array is or use some UDF or something that returns an array...always works for me, dunno if thats the way your suppose to do it though.

and for array size:

For $n = 0 To UBound($Array) - 1
;do something
Next
I do like what you tell me UBound() and here is what I get!

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.


for(loop=0; loop<infinity; loop++) { alert('I love you'); }

Share this post


Link to post
Share on other sites
LurchMan

that means you dont have it declared correctly...if your are hard coding each dimension of the array then u have to declare the size of the array.

ex:

Global $array[2]
$array[0] = "something"
$array[1] = "else"

If you are using a UDF to get the array then you can just delcare the variable

ex:

Global $array
$array = _FileListToArray($sPath)
Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
CodyBarrett

if you AREN'T resizing the array..

For $i = 0 to 2

do this

next

Share this post


Link to post
Share on other sites
LurchMan

if you AREN'T resizing the array..

For $i = 0 to 2

do this

next

this works also...im just used to having everything in a variable and i never really know how big the array is at any given time...


Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites
nht3004

Finally, I use this

$keyString="sID|sPass";
$key=StringSplit($keyString,"|");
For $i=0 To $key[0]
do.....
Next

for(loop=0; loop<infinity; loop++) { alert('I love you'); }

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.