Post Reply 
The why is there a syntax error thread
02-19-2014, 05:13 AM
Post: #1
The why is there a syntax error thread
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?
Find all posts by this user
Quote this message in a reply
02-19-2014, 05:23 AM
Post: #2
RE: The why is there a syntax error thread
the ";" after my print was missing. Geez.
Find all posts by this user
Quote this message in a reply
02-19-2014, 06:12 AM
Post: #3
RE: The why is there a syntax error thread
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;
Find all posts by this user
Quote this message in a reply
02-19-2014, 06:44 AM
Post: #4
RE: The why is there a syntax error thread
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

Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
Find all posts by this user
Quote this message in a reply
02-19-2014, 07:19 AM
Post: #5
RE: The why is there a syntax error thread
(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?
Find all posts by this user
Quote this message in a reply
02-19-2014, 02:58 PM
Post: #6
RE: The why is there a syntax error thread
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().

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)