Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending Variable's Name and Value to a function
#1
Hi All,

I find myself often using "out formatstring" in my functions to track the progress of various variables

Rather than simply having the code say

Code:
Copy      Help
out int1
I use the following
Code:
Copy      Help
out "int1 = %i" int1

so that I don't get confused about a lot of different variables tumbling out of the Output area

Since I do this so often I wanted to write a function that would automate it for me, like this

Function OutInt
Code:
Copy      Help
function str&IntNameToOut #IntValToOut

out "%s = %i" IntNameToOut IntValToOut

so that in calling function, all I would have to write is
Code:
Copy      Help
OutInt int1

The problem is that I don't know how to pass both the Name and the Value of the variable without a second line before the function like this:

Code:
Copy      Help
str IntNameToOut = "int1"

But typing this is as long as the code I am trying to replace!
Any ideas would be greatly appreciated.
Thanks!!, Stuart


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)