Empty Strings = Null

BlitzMax Forums/BlitzMax Programming/Empty Strings = Null

Brucey(Posted 2007) [#1]
SuperStrict

Local emptyString:String = ""

If emptyString = Null Then
	Print "Is null!"
Else
	Print "Is Not null, silly"
End If


..which was a wee bit of a surprise - in fact, I can't believe I only realised this today.


Gabriel(Posted 2007) [#2]
Yeah, I only came across this a month or two back too. Nice, isn't it?


Dabz(Posted 2007) [#3]
You've got to be joking me... You two never knew that, or are you just jesting?

In word(ish), I initialize strings with:-

Local someString:String = Null

Just so I know they are empty... and yes, I know "" is a bit quicker to type, but I find it reads better.

Dabz


Grey Alien(Posted 2007) [#4]
There's no need to initialise them, they are always null although sometimes I initialise them as null out of oldschool paranoia :-)


FlameDuck(Posted 2007) [#5]
Wow. That's cool!