Erase: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
'''Statement'''
Erase ''arrays''


ERASE ''arrays''
== Description ==


'''Description'''
Erase reinitializes fixed-size arrays, and releases memory allocated for dynamic-array storage. The required component, ''arrays'', is a comma separated list of one or more array variables.


ERASE reinitializes fixed-size arrays, and releases memory allocated for dynamic-array storage. The required component, ''arrays'', is a comma separated list of one or more array variables.
== Example ==
 
'''Example'''


<pre>
<pre>
REM ERASE Example
REM Erase Example
'ERASE reinitializes arrays
'Erase reinitializes arrays
DIM Children(3)
Dim Children(3)
Children(0) = "Eric"
Children(0) = "Eric"
Children(1) = "Kenny"
Children(1) = "Kenny"
Line 18: Line 16:
Children(3) = "Stan"
Children(3) = "Stan"
PrintArray Children, 4
PrintArray Children, 4
ERASE Children
Erase Children
PrintArray Children, 4
PrintArray Children, 4
FUNCTION PrintArray(arr, elements)
FUNCTION PrintArray(arr, elements)
   DIM i
   Dim i
   FOR i = 1 to elements
   For i = 1 to elements
     PRINT "#" & i&":","("&arr(i-1)&")"
     PRINT "#" & i&":","("&arr(i-1)&")"
   NEXT
   Next
   PRINT
   PRINT
END FUNCTION
END FUNCTION
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 42: Line 40:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[array|ARRAY]], [[dim|DIM]]
[[array|ARRAY]], [[dim|DIM]]
[[Category:Language Reference]]

Revision as of 21:02, 8 August 2012

Erase arrays

Description

Erase reinitializes fixed-size arrays, and releases memory allocated for dynamic-array storage. The required component, arrays, is a comma separated list of one or more array variables.

Example

REM Erase Example
'Erase reinitializes arrays
Dim Children(3)
Children(0) = "Eric"
Children(1) = "Kenny"
Children(2) = "Kyle"
Children(3) = "Stan"
PrintArray Children, 4
Erase Children
PrintArray Children, 4
FUNCTION PrintArray(arr, elements)
  Dim i
  For i = 1 to elements
    PRINT "#" & i&":","("&arr(i-1)&")"
  Next
  PRINT
END FUNCTION

Output

#1:    (Eric)
#2:    (Kenny)
#3:    (Kyle)
#4:    (Stan)
#1:    ()
#2:    ()
#3:    ()
#4:    ()

Related Items

ARRAY, DIM