Weekly Qbasic and Qb64 Lesson Topics
April 19, 2024, 01:49:50 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

Labeling Data Bit maps

Pages: [1]
  Print  
Author Topic: Labeling Data Bit maps  (Read 556 times)
OlDosLover
Guest
« on: February 12, 2011, 02:44:26 am »

Hi all,
    In QBasic DATA is read from the first position that it finds in the BAS file. To read multiple DATA statements into different variables at different times one has to use the RESTORE command in conjunction with a label. Here's an example

Code:
REM
DEFINT A_Z

OPTION BASE 1
DIM FirstDim(4)
DIM SecondDim(6)

for t= 1 to 4
  read z
  FirstDim(t) =z
next t
'place this data onscreen
for t= 1 to 4
  Print   FirstDim(t)
next t
'read the second part of the data into the 2nd dim
'we must "RESTORE" to correct place
RESTORE Twice
For t= 1 to 6
 read z
  SecondDim(t) =z
next t
'place this data onscreen
or t= 1 to 6
  Print   SecondDim(t)
next t

SLEEP
SYSTEM

'----------- DATA STATEMENTS -----
DATA 1,2,3,4

Twice:
DATA 5,6,7,8,9,0

OlDosLover.
Report Spam   Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum


Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy