|
-
Oct 25th, 2007, 01:11 AM
#1
Thread Starter
New Member
For/next
I am using Liberty BASIC v4.03 on a PC with Windows XP.
I wrote a program using FOR/NEXT commands. The first time I use it is in a section for entering data. I have no trouble entering the data until I hit enter after the last number. Then I get an error message saying "Runtime Error: Subscript out of range: 11, xO."
Here is the code for that section:
[EnterData]
FOR i=0 to 11
PRINT
PRINT "Enter temperature for data point "; i+1; "."
INPUT Temperature(i)
PRINT
PRINT "Enter pressure for data point "; i+1; "."
INPUT Pressure(i)
NEXT i
PRINT
What am I doing wrong? Should I just go back to using:
IF i > 11, GOTO [Next]
GOTO [EnterData]
?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|