Files
harbour-core/tests/array16.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

72 lines
1.0 KiB
Plaintext

// Harbour multidimensional arrays support
PROCEDURE Main()
LOCAL a := { 100, 200, "Third" }
LOCAL b := Array( 8832 )
? 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[ 8832 ] := "Harbour"
? b[ 8832 ]
? ATail( b )
ASize( b, 200 )
? Len( b )
b[ 100 ] := 10
Test( b[ 100 ]++ )
? b[ 100 ]
b[ 100 ] := 10
Test( ++b[ 100 ] )
? b[ 100 ]
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