[thelist] ASP equivalent of $var = ($a == 0) ? 'hello' : 'goodbye';
Paul Cowan
evolt at funkwit.com
Tue Dec 9 17:02:27 CST 2003
Dunstan Orchard wrote:
> Is the an ASP equivalent of PHP's syntax:
>
> $var = ($a == 0) ? 'hello' : 'goodbye';
>
> I can't seem to find anything, but I know you can do it in JS, so I
> presumed it was OK in ASP as well.
As you say, it works in JS, so in ASP you could do:
var = (a == 0) ? 'hello' : 'goodbye';
Unless, by "ASP", you meant "VBScript", in which case no, there's no
direct equivalent. You have to do something like:
if (a = 0) then var = "hello" else var = "goodbye"
which isn't really the same thing at all, but will do what you want.
Cheers,
Paul
More information about the thelist
mailing list