Results 1 to 5 of 5

Thread: Return values of function

  1. #1
    mhuibers
    Guest

    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

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    instead of returning True false, u can return string or no string ?
    -= a peet post =-

  3. #3
    mhuibers
    Guest
    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.

  4. #4
    AIS_DK
    Guest
    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.

  5. #5
    mhuibers
    Guest
    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
  •  



Click Here to Expand Forum to Full Width