Author Topic: How many DATA strings?  (Read 406 times)

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 786
    • View Profile
How many DATA strings?
« on: July 23, 2020, 11:02:04 PM »
There are a couple of good examples for accessing DATA strings in the Help File.

Here's one more that uses the UBOUND function.

 
Code: [Select]
CONST DATACOUNT = UBOUND(DATA)    ' <<<--  "DATA" must be in upper case

PRINT "*************************************************"
PRINT "There are", DATACOUNT+1, " strings in the DATA array ( 0 to 8 )."
PRINT "*************************************************"

FOR INTEGER i = 0 to DATACOUNT
  PRINT DATA$[i]
NEXT

DATA "111", "222", "333"
DATA "444", "555", "666"
DATA "777", "888", "999"


OUTPUT:

*************************************************
There are 9 strings in the DATA array ( 0 to 8 ).
*************************************************
111
222
333
444
555
666
777
888
999


Robert

  • Hero Member
  • *****
  • Posts: 601
    • View Profile
Re: How many DATA strings?
« Reply #1 on: July 24, 2020, 02:31:08 AM »
Hi MrBCX:

Thank you for this example.

As I was adding the example to the DATA statement page, I noticed several DATA and DATA$ keywords had incorrect syntax highlightling colours.

Coincidence, serendipity, or fate ?

Whatever!

They work for me.