Confusion over passing by reference vs passing by value - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2) +--- Thread: Confusion over passing by reference vs passing by value (/showthread.php?tid=559) Pages:
1
2
|
RE: Confusion over passing by reference vs passing by value - SMcNeill - 06-19-2022 As far as I know, BASIC doesn't allow one to set a whole array to some value all at once, which is what you're trying to do here: satz3() = "SagNiemalsNie!" You need an index of some sort to assign the value to, such as the below here: Code: (Select All) Dim satz3(10) As String Note also that you can not pass arrays via parenthesis. Satztest3 (satz3()) -- this is bugged and produces a c++ compile failure. Satztest3 satz3() -- change it to this and it works perfectly fine. RE: Confusion over passing by reference vs passing by value - Kernelpanic - 06-19-2022 Thanks SMcneill! It works now. I constructed this "Satztest3 (satz3())" according to the manual for QBasic, but I misunderstood something. RE: Confusion over passing by reference vs passing by value - DSMan195276 - 06-19-2022 I'm pretty sure this syntax is actually also a bug, identified in the previous QB64Team repository: Code: (Select All) feld() = feld() + "DonaldDuck" What they said was that feld()was getting treated as feld(0)by mistake, which compiles but is obviously not what you wanted. Really this syntax should just produce a compiler error, it has no meaning. This is the issue I was remembering, it should probably be added to the Phoenix Edition repo since it's still a bug: https://github.com/QB64Team/qb64/issues/216 |