|
-
Nov 28th, 2001, 10:27 AM
#1
Return values of function
Hi,
What i want to achieve is the following:
I have written a function and it returns as boolean.
But in case of a "false" value i also want to return a string and in case of a "true" value i do not want to return a string.
How should i do this?
Thanx in advance
Michiel
-
Nov 28th, 2001, 10:28 AM
#2
-= B u g S l a y e r =-
instead of returning True false, u can return string or no string ?
-
Nov 28th, 2001, 10:31 AM
#3
Yes i have thought of that too,
but instead of checking on an empty string or not i'd rather check on a boolean and in case of "false" use the string.
i know it's easier to do it your way but i am just wondering if it is something which can be done and how.
-
Nov 28th, 2001, 10:59 AM
#4
I will have to go with peet on this one, but here are two other solutions, inspired by the way C++ handles things.
1.
Return a UDT containing both a Boolean and a string, and just fill out the string, the be test turns out true.
2.
Add a string argument to the function (with the byref keyword) and give this a new value, if the functions return true. By parsing it to the function as byref, it can be changed by the function, and the calling function, will also see the changes.
-
Nov 28th, 2001, 12:24 PM
#5
Thanks AIS_DK,
You're both right i think but as i said i was wondering if it was possible.
But the stupidest thing was that I already knew how to do it!!!!!
*ehhh*
As i saw your solutions i remembered immediatly!
But i do thank both of you for your input and refreshing my memory.
Michiel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|