Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another easy one:
#3
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!"
Reply


Messages In This Thread
Another easy one: - by PhilOfPerth - 12-10-2023, 04:46 AM
RE: Another easy one: - by a740g - 12-10-2023, 04:53 AM
RE: Another easy one: - by SMcNeill - 12-10-2023, 05:01 AM
RE: Another easy one: - by a740g - 12-10-2023, 07:05 AM
RE: Another easy one: - by SMcNeill - 12-10-2023, 04:53 AM
RE: Another easy one: - by PhilOfPerth - 12-10-2023, 05:09 AM
RE: Another easy one: - by SMcNeill - 12-10-2023, 05:11 AM
RE: Another easy one: - by euklides - 12-11-2023, 01:53 PM
RE: Another easy one: - by SMcNeill - 12-11-2023, 04:05 PM
RE: Another easy one: - by JRace - 12-13-2023, 02:26 AM



Users browsing this thread: 2 Guest(s)