out of DATA

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
floogle11
Veteran
Posts: 71
Joined: Sat May 02, 2009 7:08 pm
Location: Zorgon planet
Contact:

out of DATA

Post by floogle11 » Sat Jun 12, 2010 2:30 pm

Ive been doing more with graphics and a lot of times when i use the DATA command after when i run it it says :
"Line 17:
out of DATA"
what does that mean?

Heres my code:

Code: Select all

CLS
SCREEN 13
    x = 100
    y = 100
    a = 0
    b = 0
    FOR a = 0 TO 1
        FOR b = 0 TO 1

            data 00,01,
            data 01,00,
            data 00,01,

            READ z
            PSET (x, y), z

        NEXT b
    NEXT a
Go to my Qbsite its: Trueqb.webs.com
Or if you play nazi zombies go to www.Nazizombys.com and register for cheats, hints, and strategys.

User avatar
burger2227
Veteran
Posts: 2358
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Sat Jun 12, 2010 4:35 pm

Where is the DATA? When using nested FOR loops, you will need DATA for both loops. Simply multiply the numbers of the loops to determine how many. Your code indicates 4 READs.

I advise labeling DATA fields if DATA is used more than once. Just make a line label before the DATA and use the label with RESTORE before reading it.


RESTORE MyData

READ x, y

MyData:

DATA
DATA
DATA


I recommend placing all labeled DATA fields after the main program code.
You cannot place DATA into SUB procedures.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

User avatar
floogle11
Veteran
Posts: 71
Joined: Sat May 02, 2009 7:08 pm
Location: Zorgon planet
Contact:

Post by floogle11 » Sat Jun 12, 2010 9:17 pm

Thanks a lot
Go to my Qbsite its: Trueqb.webs.com
Or if you play nazi zombies go to www.Nazizombys.com and register for cheats, hints, and strategys.

Post Reply