HP Forums

Full Version: The why is there a syntax error thread
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This thread is supposed to helpful for everyone who needs a quick help for a syntax error he can not resolve by himself. If you do come up with an answer for your own problem, it would be nice to post it here as well.


Ill start: Wink

unfortunately I am having trouble with a simple addition. I try to calculate "xmax=xmin+ymax" (non-sensical, just to get me started).

I tried:

EXPORT int2(xmin,xmax,ymin,yreal,ymax)
BEGIN
local xmin,xmax,ymin,ymax,xreal;
PRINT("oashio")
xmax:=xmin+ymax;
END;


and:

EXPORT int2(xmin,xmax,ymin,yreal,ymax)
BEGIN
local xmin,xmax,ymin,ymax,xreal;
PRINT("oashio")
xmin+ymax▶xmax;
END;


Similar to what's shown here
What's wrong?
the ";" after my print was missing. Geez.
what's wrong with this?


export int2(xmin,xmax,ymin,ymax,yreal)
BEGIN
local xmin,xmax,ymin,ymax,xreal,yreal;
xreal:=xmin+((yreal-ymin)/(ymax-ymin));
print(xreal);
END;
You don't need to declare LOCAL variables that are already declared as function parameters.
Code:
export int2(xmin,xmax,ymin,ymax,yreal)
BEGIN
local xreal;
xreal:=xmin+((yreal-ymin)/(ymax-ymin));
print(xreal);
END;
and use
RETURN(xreal);
for the answer
(02-19-2014 06:44 AM)patrice Wrote: [ -> ]You don't need to declare LOCAL variables that are already declared as function parameters.
Code:
export int2(xmin,xmax,ymin,ymax,yreal)
BEGIN
local xreal;
xreal:=xmin+((yreal-ymin)/(ymax-ymin));
print(xreal);
END;
and use
RETURN(xreal);
for the answer
Awesome, thank you. Is there a way I can have the result copied to the cas screen? I know I can get that with typing int2(...) in cas, but I love the easy input box so I don't need to remember the order of the input parameters.
Also, can I copy program names to the cas screen from the catalog?
If I understand your question correctly, you should be able to access the programs (while in CAS view) via the Toolbox. Just select the User menu and you'll see a list of programs from which to choose int2().
Reference URL's