Agreed..I like to simplify the situation to make it maintainable-
Thanks,
Martin-
----- Original Message ----- 
From: "Slattery, Tim - BLS" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Thursday, March 30, 2006 3:52 PM
Subject: RE: [java:Conditional Operators]


> I did not understand the following code with multiple 
> conditional operators.
>           boolean vIsForm=true;
>           String vForwardName = 
> (aActionMapping.findForward(vWorkForwardName) == null)
>               ? (vIsForm) ? "form" : "task"
>               : vWorkForwardName;
>   
>   Can some body explain me how to read the above code?
>   Thanks & Regards

Nasty, nasty. Very terse, but nearly unreadable. Better to untangle it
somewhat and make the code more understantable. I believe it works out
like this:


If (aActionMapping.findForward(vWorkForwardName) == null)
{
   if (vIsForm)
   {
      vForwardName = "form";
    }
   else
   {
        vForwardName = "task";
   }
}
else
{
     vForwardName = vWorkForwardName;
}


-
Tim Slattery
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to