Post Reply 
CONVERT and variables for arguments
10-17-2015, 10:03 PM
Post: #10
RE: CONVERT and variables for arguments
Added the list for the menu, called expr instead of CAS (is CAS a better alternative here?), and simplified by removing "simplify".

Code:

EXPORT CD2,CD1;
EXPORT Distance()
BEGIN
  LOCAL x,menu,unit,a1,a2,t;
  INPUT({{ x,[2],{45,20,3} }},"","Convert ");
  IF string(x,1) == "0" THEN RETURN; END;
  unit := { 1_mm, 1_cm, 1_m, 1_km, 1_inch, 1_ft, 1_yd, 1_mile };
  menu := { "mm","cm","m","km","inches","feet","yards","miles" };
  CHOOSE(CD2, "Units", menu);
  CHOOSE(CD1, "To", menu);
  a2 := unit[CD2];
  a1 := unit[CD1];
  t := x + "*" + CONVERT(a2,a1);
  expr(t);
END;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
CONVERT and variables for arguments - epp - 10-15-2015, 06:16 PM
RE: CONVERT and variables for arguments - epp - 10-17-2015 10:03 PM



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