Files
harbour-core/tests/funcarr.prg
Viktor Szakats 3ed9fa0f45 2016-01-14 19:33 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
* *
    % remove brandings and homepage from copyright header. Pass 2 - semi-auto.
    * project homepage and name is described in README, amongst others
    ; this should make the diff between 3.4 and 3.2 easier to manage
2016-01-14 19:35:07 +01:00

59 lines
1.2 KiB
Plaintext

//
// Function Array syntax test
//
// Written by Eddie Runia <eddie@runia.com>
//
// Placed in the public domain
//
PROCEDURE Main()
LOCAL a
? "Direct reference : ", aFunc()[ 1 ]
a := aFunc()
? "Ref via array : ", a[ 1 ]
aFunc()[ 1 ] := "Something different"
? "Assign new text : ", aFunc()[ 1 ]
aFunc()[ 1 ] := 4
? "Assign 4 : ", aFunc()[ 1 ]
? "Post increment : ", aFunc()[ 1 ]++
? "After : ", aFunc()[ 1 ]
? "Pre decrement : ", --aFunc()[ 1 ]
? "After : ", aFunc()[ 1 ]
aFunc()[ 1 ] += 2
? "Plus 2 : ", aFunc()[ 1 ]
aFunc()[ 1 ] -= 3
? "Minus 3 : ", aFunc()[ 1 ]
aFunc()[ 1 ] *= 3
? "Times 3 : ", aFunc()[ 1 ]
aFunc()[ 1 ] /= 1.5
? "Divide by 1.5 : ", aFunc()[ 1 ]
aFunc()[ 1 ] %= 4
? "Modulus 4 : ", aFunc()[ 1 ]
aFunc()[ 1 ] ^= 3
? "To the power 3 : ", aFunc()[ 1 ]
? "Global stack"
? hb_ValToExp( __dbgVMStkGList() ) // Please note a is a reference to aArray !
? "Statics"
? hb_ValToExp( __dbgVMVarSList() )
RETURN
FUNCTION aFunc()
STATIC s_aArray := { [Test] }
RETURN s_aArray