?
Solved

How can I make a function return  more than one value ?

Posted on 1999-06-22
3
Medium Priority
?
126 Views
Last Modified: 2010-04-06
I would like my function to return more than one string. Let's say I feed the function with a string, and then it returns eg. my first and my second name. How do I syntax the function?

/Peter
0
Comment
Question by:volavy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Expert Comment

by:Tweety
ID: 1384007
You can use many ways.
You can define your own type like this:

type
    resulttype = record
        FirstName: String
        SecondName: String
    end;

...

function SplitName(Name: String): resulttype;
var
    Name1, Name2: String;
begin
    ....
    result.^FirstName := Name1;
    result.^SecondName := Name2;
end;

Another Way is to use a procedure by using parameters by reference.
You can use a TList or aTStringlist object as functiunresult.
and many many more.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 80 total points
ID: 1384008
Procedure Func1 (var ret1 : string; var ret2 as string)
begin
  ret1 := "Arjen";
  ret2 := "Bos";
end;
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1384009
I'm sorry, I'm dreaming.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question