# HP Forums

Full Version: Return multiple values on multiple stack lines
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I've recently bought an HP Prime as a replacement for my aging 48GX. I have quite a number of small programs on the 48 that I would like to implement on the Prime.
My question is, how do I return multiple values to multiple lines on the stack (I use RPN mode)? So far, programs only return the result of the last line of code.

Here's my example, it's to calculate coordinates of the tangent point and intersection point for a conveyor belt layout. I'd like to return both TP and IP to lines 1 and 2 of the stack.

BEGIN

LOCAL TP, IP, shift, TPx, TPy, IPx, IPy;

// Determine of radius is concave or convex
IF alpha2 > alpha1 THEN shift:=270
ELSE
shift:= 90
END;

// Determine coordinates of the tangent point and the intersection points
IPx:= (TPy-TAN(alpha2)*TPx)/(TAN(alpha1)-TAN(alpha2));
IPy:=IPx*TAN(alpha1);

// Return the values to the stack
TP:=(TPx,TPy);
IP:=(IPx,IPy);

END;

any help appreciated,
Andrew
Hi Andrew,

The only way I know of is to use a list.

RETURN({TP,IP});

There are other posts on this board discussing this so you might want to do a
search for them. Maybe this will looked into for a possible update.

Hope this helps.
Jim
(03-13-2014 06:15 AM)JimS Wrote: [ -> ]Hi Andrew,

The only way I know of is to use a list.

RETURN({TP,IP});

There are other posts on this board discussing this so you might want to do a
search for them. Maybe this will looked into for a possible update.

Hope this helps.
Jim

Thanks Jim,
I'll see if that works for me.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :