UnDimAll
UnDimAll
 
Parameters: NONE
Returns: NONE
 

      UnDimAll will completely free the memory that ALL arrays are currently using. Freeing an arrays memory, that your no longer using is a good programming habit to get into.

      Once an array has been UnDimmed, it will be completely empty of all information. So before it can used again, PlayBASIC expects that you'll DIMension it.



FACTS:


      * When you call UnDimAll, PlayBASIC will delete EVERY array from memory.

      * An UnDim'd arrays can't be used again, until they have been re-created using the DIM command.

      * When you applications you don't need to call UnDimAll yourself, PlayBASIC does this when it closes for you. This is true for all media also.




Mini Tutorial:


      This example creates a handful of arrays, and displays their status before and after calling UnDimAll. This will most commonly be used to ensure your program cleans up after it'self..


  
; create some arrays
  Dim IntArray(100)
  Dim FloatArray#(500)
  Dim StringArray$(1000)
  
; declare a type called POS
  Type Pos
     x,y,z
  EndType
  
; Dim a typed array of type POS
  Dim TypedArray(5000As pos
  
; Display the status of these arrays
  Print "Int Array Status:"+Str$(GetArrayStatus(IntArray()))
  Print "Float Array Status:"+Str$(GetArrayStatus(FloatArray#()))
  Print "String Array Status:"+Str$(GetArrayStatus(StringArray$()))
  Print "Typed Array Status:"+Str$(GetArrayStatus(TypedArray().pos))
  Print ""
  
; UnDim all arrays from memory in one command
  UnDimALL
  
; Display the status of these arrays now
  Print "Int Array Status:"+Str$(GetArrayStatus(IntArray()))
  Print "Float Array Status:"+Str$(GetArrayStatus(FloatArray#()))
  Print "String Array Status:"+Str$(GetArrayStatus(StringArray$()))
  Print "Typed Array Status:"+Str$(GetArrayStatus(TypedArray().pos))
  
; display the screen and wait for a key press
  Sync
  WaitKey
  


This example will output.


  
  Int Array Status:1
  Float Array Status:1
  String Array Status:1
  Typed Array Status:1
     
     Int Array Status:0
     Float Array Status:0
     String Array Status:0
     Typed Array Status:0
        


 
Related Info: Dim | GetArrayDimensions | GetArrayStatus | ReDim | UnDim :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com