12-10-2023, 04:53 AM
It's not going to print 9 for you, as VAL doesn't do the math inside a string for you. All it does is take the string you give it -- starting from the left and moving right 1 character at a time, until it comes across an unexpected character, and then returns the value of that leading string up to that point to you.
address$ = "230 McNeil Hill Rd"
PRINT "Steve's house number is"; VAL(address$)
^ With the above, it's just going to print: "Steve's house number is 230" -- Everything after those numeric characters just get truncated and ignored.
So with your PRINT VAL("3 * 3"), it reads the leading 3. Says, "Yep! That's a number!". Reads the spaced afterwards. Says, "Nope! Not a number! The answer is 3!"
address$ = "230 McNeil Hill Rd"
PRINT "Steve's house number is"; VAL(address$)
^ With the above, it's just going to print: "Steve's house number is 230" -- Everything after those numeric characters just get truncated and ignored.
So with your PRINT VAL("3 * 3"), it reads the leading 3. Says, "Yep! That's a number!". Reads the spaced afterwards. Says, "Nope! Not a number! The answer is 3!"