Page 1 of 1

[Implemented] UBound(Array() [, Dimension])

Posted: Sun Mar 30, 2003 1:42 pm
by BackupUser
Restored from previous forum. Originally posted by Lars.

I miss a Ubound() funktion very much. It should return the number of
indexes in a Array in the specifed Dimension.

THX,

Lars
PS: Sorry for my broken English

(Implemented as 'ArraySize()')

Lars
IF ALL SEEMS PERFECT, CHECK IT AGAIN. TWICE.

Posted: Sun Mar 30, 2003 8:36 pm
by BackupUser
Restored from previous forum. Originally posted by GPI.

I don't know, what you want.
Make a little example.

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB

Posted: Sun Mar 30, 2003 9:06 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by GPI

I don't know, what you want.
Make a little example.
It is a Visual Basic command. If you do something like this:

Dim foo.l(20)
PrintN(Str(UBound(foo)))

then it will print 21.


--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)

Posted: Mon Mar 31, 2003 4:42 pm
by BackupUser
Restored from previous forum. Originally posted by Lars.

And
Dim foo.l(20,23,25)
printN(Ubound(Foo(),1)
printN(Ubound(Foo(),2)
printN(Ubound(Foo(),3)

Will print 21, 24, 26.


Lars
IF ALL SEEMS PERFECT, CHECK IT AGAIN. TWICE.

Posted: Mon Mar 31, 2003 4:56 pm
by BackupUser
Restored from previous forum. Originally posted by GPI.

This would be make only tense, when after a redimension the dim wont delteted.

For LinkedList exist a command
CountList(LinkedList())

GPI

PII 333, 256MB, Asus TNT2Ultra 32MB, AWE Gold 64 4MB

Posted: Mon Mar 31, 2003 9:10 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

As workaround you could code like I do:

Code: Select all

Dim Array.l(16)
Array(0) = 16
This Array has 17 entries - from 0 to 16.
Now for my data I use only 1 to 16, because 0 is used for the number of the possible entries = 16 (from 1 to 16).
This:

Code: Select all

Result = Array.l(0) 
would be the equivalent of your UBound command.
If you use your array for loops you have to start at 1 instead of 0.

Have a nice day...

Franco

Posted: Tue Apr 01, 2003 3:13 pm
by BackupUser
Restored from previous forum. Originally posted by Lars.

@ franko

I thought with Purebasic would the time of improvising end.
I was in an error :cry::evil:.



Lars
IF ALL SEEMS PERFECT, CHECK IT AGAIN. TWICE.