Blimey

So I once suggested that ASP.NET support a way to both declare and seed multiple variables in a single line, like so:

dim a, b, c, d as string = "Hello"
dim x,y,x as boolean = true

And I could swear that someone wrote back, "You almost can do that now, like so:

dim a,b,c as string
a=b=c="Hello"

I also believe I used the syntax, and it worked until I tried it with booleans last week. When it failed to work, I wrote some tests and concluded that the method did not work with booleans. If it was used (a=b=c=true) then only the left-most variable would be assigned (a), and that variable would be assigned the logical sum of the expression to its right:

(a=b=c=true) becomes a=(b=false) becomes (true), or a=true.

So I post this and convert that post to a lengthy blog entry complete with samples and David Penton finally asks, "So this really works with strings?" And I go and add a few lines to my sample and it doesn't work. I change that sample to try it with integers and again, it doesn't work.

Whomever it was that posted that reply, the one that said this was possible? Well I guess I didn't save the message. Unless someone pipes up, I'll assume I've been dreaming in code again, or that there was second-hand crack wafting through the neighbourhood that day. Thanks to David for humouring me.

No Comments