12-13-2023, 02:26 AM
(This post was last modified: 12-13-2023, 02:37 AM by JRace.
Edit Reason: *$%@# font size!
)
(12-11-2023, 01:53 PM)euklides Wrote: "3 * 3" is an alphanumeric expression !
Val ("3 * 3") ---> 3
Val ("5 * 2") ---> 5
Val ("8 hundred dollars") ---> 8
In some old basic, this function existed: calculating an alphanumeric expression...
X=Calculate("4 * 8")---> 32
But not here in qb64
That old Basic was probably interpreted. Interpreters have various evaluation functions built-in for internal use. Many interpreters are nothing but glorified evaluation functions.
With a compiled language, expressions must either be resolvable during compilation or resolved one step at a time using program code, unless you have a separate evaluation engine ala Steve's built into your program.
(Greenspun's tenth rule of programming: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.)
(In the modern day, this can be expanded to any sufficiently large program, involving any language(s).)