I\'ve been looking through someone else\'s code for debugging purposes and found this:
!m_seedsfilter ? good=true : m_seedsfilter==1 ? good=newClusters(Sp) :
if ( !m_seedsfilter )
good = true;
else if ( m_seedsfilter == 1 )
good = newClusters(Sp);
else
good = newSeed(Sp);
An expression followed by ?
corresponds roughly to if ( expression )
while the :
introduces something similar to an else
clause. Note that this is an expression rather than a statement, i.e.
? :
is an expression whose value is expression-1
if condition
is true, otherwise it is expression-2
.