[thelist] ASP equivalent of $var = ($a == 0) ? 'hello' : 'goodbye';

Joel D Canfield joel at spinhead.com
Tue Dec 9 15:20:47 CST 2003


> Is the an ASP equivalent of PHP's syntax:
> 
> $var = ($a == 0) ? 'hello' : 'goodbye';

If I'm understanding correctly (PHP rookie) this means if $a is zero,
$var should be 'hello', otherwise it should be 'goodbye'

If so, the shortest version I'm aware of in VBScript would be (with the
variables renamed in a more VBScript manner, at least in my opinion):

    If (intA = 0) Then strVar = "hello" Else strVar = "goodbye"

If there's a cool 'immediate if' shortcut like the PHP versoin, I'd love
to know it.

joel


More information about the thelist mailing list