> On 14 Jul 2002 at 6:21, Thomas Singer wrote:
> 
> >   int i = 1 < 2
> >      ? 3
> >       : 4;

> If you are going to the trouble of doing this, why not make 
> it a full blow if/then/else statement?  
> The entire point of the ternary operator is to save vertical space.
> 

It does save space over

if (1 < 2)
{
        i = 3;
}
else
{
        i = 4;
}

because 

if (1 < 2) i = 3;
else i=4;

is open to abuse if you want to add extra statements to the then or else
clauses later.
And it certainly saves space in a return statement:

return (obj == nil)
                ? MyNilObject
                : obj ;

 


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------

_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://lists.jetbrains.com/mailman/listinfo/eap-features

Reply via email to