09-25-2024, 04:36 PM
You can. You just need to separate it with a colon first.
The issue you're seeing is that you're trying to read a string as a number, and that's the run-time error.
For example:
That's perfectly valid data, with three data entries. QBASIC doesn't require DATA to be inside quotes, so the "Hello World" is one string, the comma is the delimiter, "Steve is Awesome" is a second string, the comma is the delimiter, "Steve's the best!" is the third string.
DATA considers ' to be a perfectly valid part of your data. It doesn't know "7 ' this is a comment" is a comment and only 7 is data. How could it tell that apart from "6' 3" tall"?
Add the colon in there, and it'll run properly for you, with no issues.
Code: (Select All)
DATA 7: ' this is a comment
The issue you're seeing is that you're trying to read a string as a number, and that's the run-time error.
For example:
Code: (Select All)
DATA Hello World, Steve is Awesome, Steve's the best!
That's perfectly valid data, with three data entries. QBASIC doesn't require DATA to be inside quotes, so the "Hello World" is one string, the comma is the delimiter, "Steve is Awesome" is a second string, the comma is the delimiter, "Steve's the best!" is the third string.
DATA considers ' to be a perfectly valid part of your data. It doesn't know "7 ' this is a comment" is a comment and only 7 is data. How could it tell that apart from "6' 3" tall"?
Add the colon in there, and it'll run properly for you, with no issues.