Files
harbour-core/tests/arrays.prg
vszakats 9687850865 2013-03-16 02:10 UTC+0100 Viktor Szakats (harbour syenar.net)
* (all files)
    * stripped svn header
    * minor cleanups
    ; use following command to find out the history of files:
       git log
       git log --follow
       git blame
       git annotate
2013-03-16 02:11:42 +01:00

70 lines
1.0 KiB
Plaintext

// Harbour multidimensional arrays support
PROCEDURE Main()
LOCAL a := { 100, 200, "Third" }
LOCAL b := Array( 10000 ) // 10.000 elements !!!
? ValType( a )
? ValType( { "A" } )
AAdd( a, "new element" )
? Len( a )
? a[ 1 ]
? a[ 2 ]
? a[ 3 ]
? a[ 4 ]
? ATail( a )
a[ 3 ] := { "this", { "seems", "to", { "work", "so", "well" } } }
? a[ 3 ][ 2 ][ 3 ][ 1 ] // "work"
a[ 3, 2 ][ 3, 1 ] := "Harbour power!" // different ways to specify the indexes
? a[ 3, 2, 3, 1 ]
? ValType( b )
? Len( b )
b[ 8000 ] := "Harbour"
? b[ 8000 ]
ASize( b, 2000 )
? Len( b )
b[ 1000 ] := 10
Test( b[ 1000 ]++ )
? b[ 1000 ]
b[ 1000 ] := 10
Test( ++b[ 1000 ] )
? b[ 1000 ]
b := { 1, { 2, { 4, 5 } } }
Test( b[ 2 ][ 2 ][ 1 ]++ )
? b[ 2 ][ 2 ][ 1 ]
b[ 2 ][ 2 ][ 1 ] := 2
Test( ++b[ 2 ][ 2 ][ 1 ] )
? b[ 2 ][ 2 ][ 1 ]
ReleaseTest()
RETURN
FUNCTION Test( n )
? n
RETURN NIL
FUNCTION ReleaseTest()
LOCAL a := { 1, 2, 3 }
HB_SYMBOL_UNUSED( a )
RETURN NIL