Page 1 of 1

Define inconsistency

Posted: Sun Jan 30, 2022 12:56 pm
by novablue
Does anyone else find it inconsistent that defining a map, list or array will clear its values but defining a variable does not:

Code: Select all

Define NewList TestList.i()
Define Var.i

AddElement(TestList()) : TestList() = 1 : AddElement(TestList()) : TestList() = 2 : AddElement(TestList()) : TestList() = 3
Var = 123

ForEach TestList() 
    Debug TestList()
Next
Debug Var

Debug "-------------"

Define NewList TestList.i()
Define Var.i

ForEach TestList() ; Now Empty
    Debug TestList()
Next
Debug Var ; Still there

Re: Define inconsistency

Posted: Sun Jan 30, 2022 1:25 pm
by mk-soft
Actually, there is the function ClearList.
That NewList works and thus creates a new list is new to me. It says so. New-List

It is also good that the variables are not overwritten.

It doesn't bother me at all.