if(arr) now a warning

JN via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 10 02:13:57 PDT 2015


For me personally "if (arr)" means "if I have a non-null array 
and there is something inside", so that something like while 
(arr) { remove_element(arr[0]); } would also work. Same way it 
works in Python, where:

a = None
if (a) // evaluates to false

a = []
if (a) // evaluates to false

a = [5]
if (a) // evaluates to true


More information about the Digitalmars-d mailing list