Talk:Qt Coding Style: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(suggestion for Conditional Operator)
 
 
Line 19: Line 19:
         : result2;
         : result2;
</code>
</code>
:To me, this looks like just a case of the usual line continuation and indentation rules. --[[User:Ossi|Ossi]] ([[User talk:Ossi|talk]]) 12:20, 8 June 2015 (UTC)

Latest revision as of 12:20, 8 June 2015

A suggestion(Liang Qi, 2015-06-08)

Conditional Operator

  • If the statement is too long and need to wrap,
return yourobject.function1()
        ? result1
        : result2;
  • For nested conditional operator,
return yourobject.function1()
        ? yourobject.function2()
           ? result1_1
           : result2_2
        : result2;
To me, this looks like just a case of the usual line continuation and indentation rules. --Ossi (talk) 12:20, 8 June 2015 (UTC)