Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VAL = ? (solved)
#2
Will investigate this (it should work in both cases).

However, bear in mind that VAL in Sinclair BASIC actually calls the ROM interpreter, and that ZX BASIC calls the ROM too for maximum compatibility. However evaluating variables won't work, since "x" must be declared in the Sinclair BASIC variable space, and the compiler does another thing. The same applies for functions (i.e. SQR, SIN, COS...). If you evaluate VAL("SQR 2") it will work if you use the "SQR" token. But if you type "SQR(2)" letter by letter it will fail.

Most BASICs (other than Sinclair) will always return 0 in this case, because VAL only parse numbers, not expressions. Since this is *compiled* BASIC, using dynamic VAL evaluation is complex and costly. However if you need it, there's a function that even run entire BASIC code from within compiled BASIC.
Reply


Messages In This Thread
VAL = ? (solved) - by zarsoft - 10-31-2023, 03:33 PM
RE: VAL = ? - by boriel - 11-02-2023, 11:11 AM
RE: VAL = ? - by zarsoft - 11-02-2023, 11:20 AM
RE: VAL = ? - by boriel - 11-05-2023, 09:08 AM
RE: VAL = ? - by zarsoft - 11-05-2023, 01:51 PM
RE: VAL = ? - by boriel - 11-07-2023, 11:13 PM
RE: VAL = ? - by zarsoft - 11-08-2023, 12:25 AM
RE: VAL = ? - by boriel - 01-03-2024, 10:28 PM
RE: VAL = ? - by zarsoft - 01-03-2024, 11:44 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)