` Returning mulitple values from a function (Robert Fred Meyer ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Returning mulitple values from a function
1999-02-05 -- Robert Fred Meyer
 
As mentioned by the other two, passing by address is the best way to get multiple values returned. But if you really want multiple values returned without passing by address then there is a way. Make a project for the following program and run it. --------------------------------------------------------------------------- program map MultiReturn(ulong xV1, ulong xV2, ulong xV3),string end ! map MultiReturns group V1 ulong V2 ulong V3 ulong end ! group code MultiReturns = MultiReturn(3,5,7) message('V1: ' & MultiReturns.V1 & | '|V2: ' & MultiReturns.V2 & | '|V3: ' & MultiReturns.V3 ) MultiReturn procedure(ulong xV1, ulong xV2, ulong xV3) MR group(MultiReturns) end ! group code MR.V1 = xV1 * xV1 MR.V2 = xV2 * xV2 MR.V3 = xV3 * xV3 return(MR) --------------------------------------------------------------------------- Jean-Marc comments: Put simply, you just declare a function to return a string and you return a group. You then reads the values from the group.


Today is April 28, 2024, 7:08 am
This article has been viewed 35109 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: