Page 1 of 1

Data-command

Posted: Thu Jul 29, 2004 6:08 pm
by Balatro
Are there any differences between:

Code: Select all

Data.S "A banana"
Data.S "An apple"
Data.S "A melon"

(and so on...)
and:

Code: Select all

Data.S "A banana", "An apple", "A Melon"

(and so on...)
in efficiency, memory use etc.? I was just wondering because I have a project which will use *a lot* of data-lines and I wanted to know what way I should write them down.

Posted: Thu Jul 29, 2004 6:37 pm
by Manolo
Hi,
The traditional Datas in Basic is same that in PureBasic, with minimal diferences:

Code: Select all


Dim Test.s(3)

DataSection
  Data.s "one","two","eleven"
EndDataSection

For i=1 to 3
 Read Test.s(i)
Next

Debug Test(3)

Please, read the mannual.

Regards,
Manolo[/code]

Posted: Thu Jul 29, 2004 6:47 pm
by Codemonger
@Balatro

Their is no difference as PB compiler will output's ASM, and assembly is sequential, so the two should look identical.

The later example you used is more efficient for the end-user (you ) because it's more compact and easy to understand that all data following the comma will be a string. Otherwise their is no extra memory requirements or speed decreases etc.