Data-command

Just starting out? Need help? Post your questions and find answers here.
Balatro
User
User
Posts: 15
Joined: Sun Oct 05, 2003 2:27 pm

Data-command

Post 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.
Manolo
User
User
Posts: 75
Joined: Fri Apr 25, 2003 7:06 pm
Location: Spain

Post 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]
Return to the forum
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post 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.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Post Reply