A Null String

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

A Null String

Post by armsys » Sun Apr 27, 2008 1:14 pm

Let>x=
Is x technically a null string? From the MS Deubg > Watch list, it show x is null string. BTW, what's the data type of x in this case?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 28, 2008 1:22 am

Let>x=
Is x technically a null string?
Yes, at least I believe it to be true. To prove it use the "set variables on the fly" technique you spoke of recently. If we set x to nul then set nul to a value through the on the fly assignment using "x", all subsequent variables set to nul will have the new value of nul.

For example:

Code: Select all

Let>x=
Let>%x%=2
Let>xx=
MDL>xx
I could be wrong but I believe this proves that setting a variable in the form

Let>x=

actually sets the variable to something and THAT something is nothing (nul), unless you change "nothing" to another value.

Hope this makes sense... (not even sure it makes sense to me...)

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Apr 28, 2008 2:43 am

Hi JRL,
Thanks for conceiving such a wonderful thought provocative sample script. I'm dumbfounded by the discovery that, referring to line 2 in your script, 2 is assigned to NOTHING. And, in line 3, you assign the NOTHING to XX. In line 4, since you've already assigned 2 to the NOTHING, the 2 is now assigned to XX. That's a big eye-opener.

That's exactly why I ask in my originating post what data type is assigned to the NOTHING.

Another discovery: there's no way to kill variables in MS script (to release memory).

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Apr 28, 2008 8:40 am

Let>x=

Actually sets x to an EMPTY STRING.

You may find it conceptually easier to understand if you do:

Let>x={""}

In VB it would be:

x = ""
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts