Erase: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


<pre>
<pre>
REM Erase Example
Rem Erase Example
'Erase reinitializes arrays
'Erase reinitializes arrays
Dim Children(3)
Dim Children(3)
Line 18: Line 18:
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>


Line 42: Line 42:
== Related Items ==
== Related Items ==


[[array|ARRAY]], [[dim|DIM]]
[[array|Array]], [[dim|Dim]]


[[Category:Language Reference]]
[[Category:Language Reference]]

Revision as of 00:41, 24 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