Data is good for storing lots of strings or numbers that aren't going to change.. for instance in one of my progs, I have:
Type Pass
Field RLL1
Field RLL2
Field MFM
Field intval
Field Bitmask$
Field Encode$
End Type
Restore PassData
Read passes
For i = 1 To passes
bit.pass = New pass
Read bit\rll1
Read bit\rll2
Read bit\mfm
Read bit\intval
Read bit\bitmask$
Read bit\encode$
Next
.passdata
Data 27
Data 1,0,1,1431655765,"01010101 01010101 01010101","0x55"
Data 1,0,1,-1431655766,"10101010 10101010 10101010","0xAA"
Data 0,1,1,-1843115630,"10010010 01001001 00100100","0x92 0x49 0x24"
Data 0,1,1,1234314313,"01001001 00100100 10010010","0x49 0x24 0x92"
Data 0,1,1,608801316,"00100100 10010010 01001001","0x24 0x92 0x49"
Data 1,1,0,0,"00000000 00000000 00000000","0x00 0x00 0x00"
Data 1,0,0,286331153,"00010001 00010001 00010001","0x11"
Data 1,0,0,572662306,"00100010 00100010 00100010","0x22"
Data 1,1,0,858993459,"00110011 00110011 00110011","0x33"
Data 1,0,0,1145324612,"01000100 01000100 01000100","0x44"
Data 1,0,1,1431655765,"01010101 01010101 01010101","0x55"
Data 1,1,0,1717986918,"01100110 01100110 01100110","0x66"
Data 1,0,0,2004318071,"01110111 01110111 01110111","0x77"
Data 1,0,0,-2004318072,"10001000 10001000 10001000","0x88"
Data 1,1,0,-1717986919,"10011001 10011001 10011001","0x99"
Data 1,0,1,-1431655766,"10101010 10101010 10101010","0xAA"
Data 1,0,0,-1145324613,"10111011 10111011 10111011","0xBB"
Data 1,1,0,-858993460,"11001100 11001100 11001100","0xCC"
Data 1,0,0,-572662307,"11011101 11011101 11011101","0xDD"
Data 1,0,0,-286331154,"11101110 11101110 11101110","0xEE"
Data 1,1,0,-1,"11111111 11111111 11111111","0xFF"
Data 0,1,1,-1843115630,"10010010 01001001 00100100","0x92 0x49 0x24"
Data 0,1,1,1234314313,"01001001 00100100 10010010","0x49 0x24 0x92"
Data 0,1,1,608801316,"00100100 10010010 01001001","0x24 0x92 0x49"
Data 0,1,0,1843115629,"01101101 10110110 11011011","0x6D 0xB6 0xDB"
Data 0,1,0,-1234314314,"10110110 11011011 01101101","0xB6 0xDB 0x6D"
Data 0,1,0,-608801317,"11011011 01101101 10110110","0xDB 0x6D 0xB6"By simply listing the data and READing it, it's a lot quicker (and CLEANER) than typing out:
bit.pass=new pass
bit\rll=0
bit\rll2=1
bit\bitmask$="11011011 01101101 10110110"
bit\hex$="0xDB 0x6D 0xB6"
bit\ETC ETC ETC :)
repeat ad nauseum for every data statement in the program. Now that's only a small data set, but some programs use much larger data sets. Data isn't AS necessary as it used to be. On the old Apple ][ for instance, it was hard to read any data information from an external file - so all your info (image drawing data, conversation data, etc) had to be stored in the one program. Thats where data was useful.
It still is useful, as I demonstrated above - but not as much so, since we now can read/write from multiple files simultaneously without any trouble. Basically - it all depends on how much data you're using. If you're using 0-100 lines of data info - just shove it into your program as DATA statements. its pointless to add ANOTHER file to the distro just with 50 lines of data that could easily be packed into the main code. If you're going over 100 lines of data you need, consider storing it in an external file. :)
Happy coding! ;)
+BlackD