'ByRef default arguement passing test
cr = chr( 10 ) + chr ( 13 )
sub testSys( sys aSys )
aSys = 42
end sub
sub testDouble( double aDouble )
aDouble = 42.42
end sub
sub testString( string aString ) 'so passed ByVal?
aString = "Forty-Two"
end sub
sys i = 0
double d = 0.0
string s = "Zero"
string txtOut = ""
txtOut += "Testing sys passed as default ByRef"+ cr
txtOut += "i before sub call, should be 0 : i = " + str( i ) + cr
testSys( i )
txtOut += "i after sub call, should be 42 : i = " + str( i ) + cr
txtOut += cr + cr
txtOut += "Testing double passed as default ByRef"+ cr
txtOut += "d before sub call, should be 0.0 : d = " + str( d, 2 ) + cr
testDouble( d )
txtOut += "d after sub call, should be 42.42 : d = " + str( d, 2 ) + cr
txtOut += cr + cr
txtOut += "Testing string passed as default ByRef"+ cr
txtOut += "s before sub call, should be Zero : s = " + s + cr
testString( s )
txtOut += "s after sub call, should be Forty-Two : s = " + s + cr
txtOut += cr + cr
print txtOut
sub test2Sys( ByRef sys aSys )
aSys = 42
end sub
sub test2Double( ByRef double aDouble )
aDouble = 42.42
end sub
sub test2String( ByRef string aString )
aString = "Forty-Two"
end sub
i = 0
d = 0.0
s = "Zero"
string txtOut = ""
txtOut += "Testing sys passed ByRef"+ cr
txtOut += "i before sub call, should be 0 : i = " + str( i ) + cr
test2Sys( i )
txtOut += "i after sub call, should be 42 : i = " + str( i ) + cr
txtOut += cr + cr
txtOut += "Testing double passed ByRef"+ cr
txtOut += "d before sub call, should be 0.0 : d = " + str( d, 2 ) + cr
test2Double( d )
txtOut += "d after sub call, should be 42.42 : d = " + str( d, 2 ) + cr
txtOut += cr + cr
txtOut += "Testing string passed ByRef"+ cr
txtOut += "s before sub call, should be Zero : s = " + s + cr
test2String( s )
txtOut += "s after sub call, should be Forty-Two : s = " + s + cr
txtOut += cr + cr
print txtOut