Authors
Publication
Pub Details
Date
Pages
BASIC Terms
To see what VAL$ does, enter:
100 LET a=6: LET b=9
110 LET a$="a"+"+b"
200 PRINT 200,VAL a$
240 PRINT 240,VAL$ "a$"
250 PRINT 250,VAL$ """a$"""
260 PRINT
1000 PRINT VAL$ """a$""";" evaluates to ";VAL$ "a$";" by using theVAL$ function and to ";VAL a$;" by usingthe VAL funtion."
RUN the program and see on the display what each function does.
You can use this to print both your formula and its number value from a string variable. Succinctly put, VAL$ gives you the string that VAL evaluates, the right-hand side of the equation for A$, by returning some steps earlier. If you have access to a Spectrum manual, you’ll find its explanation clearer than that offered by Timex.
This feature demonstrated is one of the subtleties implied by the statement “Sinclair machines always call the expression evaluator”, and plays a role in the sometimes odd report codes that result from failures at intermediate steps.
Products
Media
Image Gallery
Source Code
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.