Talk:SmileBASIC (Petit Computer 3)/@comment-15296152-20150714050334/@comment-15296152-20150714175054

I'm fine if I can't use OUT to return an array, so long as I can pass an array as a parameter for a DEF block and change its contents within it so when it exits the block, the changes will remain for that array that was passed in. I'm just trying to learn how to use this when I don't have access to it yet. Them passing as references, imo, seems like a good idea. The ability to return an array (even if it does it as a reference) that was created within a DEF block is rather interesting, and actually, can be quite useful, so long as you don't do something that could cause it to continually allocate over and over to the point of being OUT_OF_MEMORY. Thanks for the info (and correct ways of doing things).

If you don't mind Bluesun1, if it does things with arrays by reference (including those when doing RETURN), then would I be correct in assuming that if you simply assigned one array to the other (OUT_A = IN_A) when both were previously allocated already, would it just replace the reference, thereby making them both the same array insomuch that changing a value in an element for one is reflected in the other? Or, would it do a copy of contents from one to the other? Or would it just error out?

Calc84maniac,

I assume that if it goes by references, allocated blocks for arrays would have a list of all names referencing them, and that once it loses all references, it gets handled by a garbage collector, since there would be no way to re-reference the data.