Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call by reference / value
#3
Thing to remember is that passing via reference only works IF variable types match.  For example, change the types from DOUBLE to _FLOAT in the program above.

Best practice, if one doesn't want values to pass by reference, is just to pass to temp variables.

SUB foo(tempX, tempY)
    x = tempX: y = tempY
    'Now use x/y with zero worry over changing your original variable values.
Reply


Messages In This Thread
Call by reference / value - by Kernelpanic - 11-27-2023, 07:54 PM
RE: Call by reference / value - by mnrvovrfc - 11-27-2023, 11:19 PM
RE: Call by reference / value - by SMcNeill - 11-28-2023, 02:36 AM
RE: Call by reference / value - by TerryRitchie - 11-28-2023, 03:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How Many Years Until QB64ers are CALL OBSOLETE? Pete 62 3,823 02-20-2026, 03:15 AM
Last Post: bert22306
  You never CALL Pete 13 2,416 12-02-2022, 12:23 AM
Last Post: mnrvovrfc
  Call a video from QB64 Kernelpanic 3 908 09-02-2022, 05:35 PM
Last Post: Kernelpanic
  Variable as a reference or value to a function Kernelpanic 22 4,260 08-08-2022, 07:41 PM
Last Post: bplus
  Confusion over passing by reference vs passing by value hanness 12 2,708 06-19-2022, 10:58 PM
Last Post: DSMan195276

Forum Jump:


Users browsing this thread: 1 Guest(s)