faqts : Computers : Programming : Languages : Bbcbasic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

BBCBASIC: Windows: Array: Size: Total: How to find out the total amount of elements in an array?

Feb 22nd, 2006 08:01
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 22 February 2006 - 03:18 pm -------------------

BBCBASIC: Windows: Array: Size: Total: How to find out the total amount 
of elements in an array?

---

Use the command

 DIM( <your array name>(), 1 )

===

e.g.

Steps: Overview:

 1. -Create your array

      e.g.

       DIM myArray( 10 )

 2. -Print the total amount of elements in this array

      PRINT DIM( myArray(), 1 )

 3. -If you run this, this will print

      10

===

e.g.

--- cut here: begin --------------------------------------------------

 DIM myArray( 10 )
 PRINT DIM( myArray(),1 )
 END

--- cut here: end ----------------------------------------------------

===

e.g.

Use the total amount of elements in a given array to
show all the current values stored in that array

--- cut here: begin --------------------------------------------------

 DIM myArray( 10 )
 :
 I% = 0
 minI% = 0
 maxI% = DIM( myArray(),1 )
 :
 FOR I% = minI% TO maxI%
  PRINT myArray( I% )
 NEXT I%
 END

--- cut here: end ----------------------------------------------------

===

File: see also:

..\BBCBASIC for Windows\LIB\arraylib.bbc

===

Internet: see also:

---



----------------------------------------------------------------------