* tests/ac_test.prg
* tests/ac_test2.prg
* tests/begin.prg
* tests/box.prg
* tests/byref.prg
* tests/codebl.prg
* tests/codebloc.prg
* tests/db_brows.prg
* tests/ddate.prg
* tests/ifinline.prg
* tests/memvar.prg
* tests/menutest.prg
* tests/readhrb.prg
* tests/speed.prg
* tests/speedtst.prg
* tests/stripem.prg
* tests/switch.prg
* tests/testbrw.prg
* tests/testcdx.prg
* tests/testdecl.prg
* tests/testhrb.prg
* tests/testpre.prg
* tests/testwarn.prg
* tests/tstalias.prg
* tests/tstmacro.prg
* tests/varparam.prg
* more cleanups. (assignment operator and string quote usage)
62 lines
927 B
Plaintext
62 lines
927 B
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
// Managing variables by reference
|
|
|
|
PROCEDURE Main()
|
|
|
|
STATIC s := 10
|
|
|
|
LOCAL x := 0
|
|
|
|
QOut( "Managing LOCAL variables by reference" )
|
|
QOut( "In main before ref1 x=", x )
|
|
ref1( @x )
|
|
QOut( " In main after ref1 x=", x )
|
|
|
|
|
|
QOut( "Managing STATIC variables by reference" )
|
|
QOut( "In main before ref1 s=", s )
|
|
ref1( @s )
|
|
QOut( " In main after ref1 s=", s )
|
|
|
|
RETURN
|
|
|
|
FUNCTION ref1( x )
|
|
|
|
x++
|
|
QOut( " In ref1 before ref2 =", x )
|
|
Ref2( @x )
|
|
QOut( " In ref1 after ref2 =", x )
|
|
|
|
RETURN nil
|
|
|
|
FUNCTION ref2( x )
|
|
|
|
x++
|
|
QOut( " In ref2 before ref3 =", x )
|
|
Ref3( @x )
|
|
QOut( " In ref2 after ref3 =", x )
|
|
|
|
RETURN nil
|
|
|
|
FUNCTION ref3( x )
|
|
|
|
STATIC a
|
|
|
|
x++
|
|
QOut( " In ref3 before ref4 =", x )
|
|
a := { x, x }
|
|
Ref4( @a )
|
|
QOut( " In ref3 after ref4 =", x )
|
|
|
|
RETURN nil
|
|
|
|
FUNCTION ref4( a )
|
|
|
|
a[ 1 ]++
|
|
QOut( " In ref4 =", a[ 1 ] )
|
|
|
|
RETURN nil
|