Also, I'd like to write up some Functional modules for QB. I'm nearly certain it's not available yet, but would like to do
QBArray_Map( fn, SourceArray ) -> TargetArray
QBArray_Reduce( fn, SourceArray ) -> FinalResult
, at the least. If there's already something like that, can you let me know, so as to avoid reinventing the wheel?
Hi bplus,
Coupla quesitons
1) Does _PrintString(xpix, ypix), text$ return the cursor back to the original location, before calling it? I didn't mention this in the original post, but edited it afterwards.
2) Do these routines work in 4.5? I like to go back & forth between 64 and 4.5, testing in each environment. At least for now.
This is a really nice comprehensive page, thanks. - https://www.qb64sourcecode.com/Task7.html
What? Explain in English... BTW Functions can not return arrays ie nope() = FunctionName() (x, y, z)
but you can rewrite an array in a Sub (or Function) like
Sort (myArray() as something)
sub Sort(MyArr() as say Integer)
' some sort routine
end sub
Sorry I put () around arguments when calling a sub, wrong unless you use outdated CALL keyword first.
Sort myArray()
is what the "call" to a Sort sub looks like these days.
For Screen 0: You can get the current row and column using CSRLIN and POS(0). Read/store those in variables first and use LOCATE to get back to that position later.
So the arrays are always passed by reference, correct? So if you pass one to a Sub or Function, and that module modifieds the array, then when you return from that module, the array remains modified. Is that right?
Thanks,
Everything is passed by reference, QB64 is unusual in that. If you change a variable value inside a procedure (Sub or function) that value will be preserved when return from procedure IFF you use the same Type in variable pass as Type defined in Procedure. You can overcome this by setting varaibles as copies of arguments inside the procedure and then change those all you want inside procedure.