Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

224 EVAL evaluate Purpose This function is mainly used to enable the user to type an expression, such as a mathematical equation, into the computer while a program is running. For example, suppose that a program has to plot a graph; you need a way of getting your equation into the computer while a program is running. In most versions of BASIC this is very difficult to do. With the BBC BASIC the equation is put into a string and then EVAL is used to tell the computer to work out the string. The function is not common in other versions of BASIC so a few more specific examples are given of instructions which can be evaluated by the statement EVAL A$ .

A$="M*X+C" A$="SIN(x/120)+COS(x/30)" Note that EVAL can be used to evaluate functions ( SIN , COS , SQR etc) but cannot be used to execute a statement like MODE 4 . Examples 100 X=EVAL(A$) 234 value=EVAL (z$) Description A statement which applies the interpreter’s expression evaluation program to the characters held in the argument string. An easy way to pass a function into a program from a user input. Syntax = EVAL ( ) or = EVAL ( ) Associated keywords VAL , STR$