Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!pro-colony.cts.com!jamesh From: jamesh@pro-colony.cts.com (James Howell) Newsgroups: comp.sys.apple Subject: Re: I don't think I made myself clear... Message-ID: <8908121000.AA16002@trout.nosc.mil> Date: 11 Aug 89 16:42:30 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 25 Network Comment: to #8800 by pete@pro-europa.cts.com > ?3*4-2 > 3*4-2 = 10 Hey, applesoft (or most languages for that matter) are not going to let you stick any expression under the sun into a variable and have it evaluated. The best way would be to parse the string and recursively (yes it can be done in basic) evaluate the expression. Another way would be to use a stack to convert to post fix and evaluate straight thru. If you know the apple well, there is an easier alternative. Put a REM statement in your code where you want the expression evaluated. Make it long enough that the longest expression you want to evaluate would fit. Then input your expression, poke in the "RESULT = ", then poke in the expression from your variable, then poke in ": REM". Then when the line that used to contain the REM is executed, your expression gets evaluated. You will probably want to parse the expression for syntax errors though, and that would mean you might as well write the code to evaluate the expression (parsed). If you want el cheapo syntax checking, use ON ERR GOTO, and check to see if the error code is a syntax error on that line, if so take appropriate action (ie. a message). - Jim