Skip to main content

WRITE

Syntax

WRITE offset, [variable_list]

Description  --- Not Available on the ARMmite

Writes data stored in the Flash memory shared with DATA command. The offset is used to change the location within the data array that will be written. The elements of the variable_list must be of basic types, numeric, strings or elements of arrays. 4K bytes are available for DATA and/or WRITE.  This is equivalent to 1024 elements.  Each element of the variable list is written into this space as a 32bit value starting at offset . The RESTORE  statement resets the next-element pointer to the start of the DATA.  This allows the user to alter the order in which the DATA are READ.

Example

' Create an array of 5 integers and a string to hold the data.

DIM h(4)

DIM hs$(30)

' Set up to loop 5 times (for 5 numbers... check the data)

FOR read_data = 0 TO 4

' Read in an integer.

READ h(read_data)

' Display it.

PRINT "Number"; read_data;" = "; h(read_data)

NEXT

' Spacer.

PRINT

' Read in a string.

READ hs$

' Print it.

PRINT "String = " + hs$

' Await a keypress.

SLEEP

' Exit program.

END

' Block of data.

DATA 3, 234, 4354, 23433, 87643, "Bye!"

Differences from other BASICs

 

  • Does not exist in Visual BASIC 
  • PBASIC allows modifiers for size. 

See also