Clr, Clear

Fast clearing (set to 0) of a variable, array, structure or structure property. Beware of Data Type Memory Block! Here you should use the Release method of that object instead of erasing the reference, otherwise the referenced memory will be inaccessible. Syntax:

  1. Clr Variable - Set Variable value to zero
  2. Clr Variable() - Set all element values of the array to zero

Info
Variable includes declared structures. In this case, all values of that structure will be set to zero.You may also set individual properties of a structure to zero, array elements or a whole array of a structure.

Example1:

  dim a(100) as byte
  dim b as integer
  dim s as string
 
  clr a(4)  ' set 5th element of array "a" to 0
  clr a()   ' set whole array "a" to 0
  clr b     ' set b to 0
  clr s     ' set string to ""

Example2:

  ' declare structure
  struct date
    byte hour
    byte minute
    byte second
    byte wert(5)
  endstruct
  ' declare such a structure
  dim d as date
  clr d.hour    ' set hour to 0
  clr d         ' set all values to 0
  clr d.value(3) ' set 4th element of array "value" to 0
  clr d.value()  ' set whole array "value" to 0