トピック
Phoenix B) epicphoenix4

DATA. How does it work?

I feel like I'm missing out on a big chunk of BASIC without knowing how to use DATA. So tell me what is it used for and how.
4そうだね
プレイ済み
返信[1]
親投稿
komodo † 406mario
I'm stil new to smilebasic but I think I understand the data now what do you want to know?
1そうだね
プレイ済み
返信[2]
親投稿
DasEtwas MyTheo00
DATA is used whan you have big amounts of data to store, in a linear way. first, place a goto label: @ANYTHING then you place DATA statements DATA 34, "Thomas", "Cake" DATA can have any amount of variables in one command then, to retrieve the data:
4そうだね
未プレイ
返信[3]
親投稿
DasEtwas MyTheo00
use RESTORE @ANYTHING then just a simple command to retrieve the data READ AGE, NAME$, FOOD$ when you use this with multiple DATAs, the read command automatically goes one data forward
3そうだね
未プレイ
返信[4]
親投稿
DasEtwas MyTheo00
so, if you want to store a map made out of tiles with IDs, use this code: DIM M(4,4) @MAP DATA 1,2,2,3 DATA 2,2,3,3 DATA 1,1,2,3 DATA 1,1,1,2 then RESTORE @MAP FOR I=0 TO 3 READ M(0,I), M(1,I), M(2,I), M(3,I) NEXT now you have converted the DATA block into an array
1そうだね
未プレイ
返信[5]
親投稿
Phoenix B) epicphoenix4
I'm a bit confused, but that helped ALOT. And you what they say don't learn to code, code to learn.
3そうだね
プレイ済み
返信[6]
親投稿
Phoenix B) epicphoenix4
KNOW! know what they say.
3そうだね
プレイ済み