RJE Posted July 5, 2010 Share Posted July 5, 2010 This is so simple that it is frustrating and I can't get it to work. Been at it most of the day. I have a sequence that I call as a function. This sequence, when done has 4 numbers that I want to return. The sequence calcs NumA, B, C & D which I would like to return all 4 numbers to the calling sequence and then deal with each number. I can change the return() for each number and all works well but pulling all 4 numbers back is a lost cause, so far. Help! Link to comment Share on other sites More sharing options...
AzeoTech Posted July 5, 2010 Share Posted July 5, 2010 This is a challenge in most languages to do right. Anyhow, in daqfactory just put the four values into an array and return the array: private ret ret[0] = a ret[1] = b ret[2] = c ret[3] = d return(ret) Link to comment Share on other sites More sharing options...
RJE Posted July 7, 2010 Author Share Posted July 7, 2010 Yes, that works just fine. At least I was on the right track trying to figure it out. In your example you declare ret as private, I would have thought it should be global (as I did). Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted July 7, 2010 Share Posted July 7, 2010 If it was global, you wouldn't need to return() it. It'd be available from anywhere and would also clutter the global namespace. All languages work this way. You should almost always be returning a private. In fact, you should make as many variables as you can private. Link to comment Share on other sites More sharing options...
RJE Posted July 8, 2010 Author Share Posted July 8, 2010 I understand, makes good sense. Would be nice to spend alot of time immersed in DF to learn all its secrets that would only be gained from experience. Even though I'm just using it in a hobby sort of way I keep learning, which is important. So when we land a nice project at work that needs a package like this, I'll be ready. Link to comment Share on other sites More sharing options...
AzeoTech Posted July 8, 2010 Share Posted July 8, 2010 Most of the concepts follow standard programming practices, so its also a great way to learn basic programming... Enjoy! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.