=====Passing arrays to SUBs and FUNCTIONs=====
//by Richard Russell, March 2014//\\ \\ LB Booster provides the capability of passing an entire array as a parameter to a SUB or a FUNCTION. Here is a simple example:\\
one(5) = 123
call test one()
end
sub test two()
print two(5)
end sub
To demonstrate that the array **two()** is genuinely 'local' to the SUB:\\
one(5) = 123
two(5) = 456
call test one()
print two(5)
end
sub test two()
print two(5)
end sub
Arrays are automatically passed 'by reference' (you don't need to specify BYREF):\\
one(5) = 123
two(5) = 456
call test one()
print two(5)
print one(5)
end
sub test two()
print two(5)
two(5) = 789
end sub
But you **must** use BYREF if you want to REDIM the array inside the SUB (requires LBB v2.53 or later):\\
one(5) = 123
two(5) = 456
call test one()
print two(5)
print one(15)
end
sub test byref two()
print two(5)
redim two(15)
two(15) = 789
end sub
Of course you can use a FUNCTION instead of a SUB:\\
one(5) = 123
two(5) = 456
print test(one())
print two(5)
print one(5)
end
function test(two())
test = two(5)
two(5) = 789
end function