I want to know which code looks better and if both have the same effect
private boolean canGenerateValue(Table1 _table1)
{
if(_table1 && _table1.Field1 == NoYes::No &&
(_table1.Type == Type::A
&& Parameters::find().FieldX == NoYes::Yes
&& Table2::find(_Table1.Id).FieldA== NoYes::Yes
)
||
(
_table1.Type == Type::B
)
)
{
return true;
}
else
{
return false;
}
OR
{
if(_table1&& _table1.Field1 == NoYes::No)
if (_table1.Type == Type::A)
{
return true;
return false;
else if(_table1.Type == Type::B)
return true;
return false;
{
if(_table1&& _table1.Field1 == NoYes::No)
if (_table1.Type == Type::A && Parameters::find().FieldX == NoYes::Yes && Table2::find(_Table1.Id).FieldA== NoYes::Yes)
{
return true;
else if(_table1.ype == Type::B)
return true;
return false;
-- and for the first option, since I have mix of && and || --- what is the best way to place them, sometimes i see the && on the same line and the || on a new line alone and sometimes the opposite