Du code simple et lisible !
Citations
- Programs must be written for people to read, and only incidentally for machines to execute.
- Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Exemples
if( a < b ) {
return true;
}
else {
return false;
}
|
return a < b;
|
if( it_current == it_end ) {
std::forward_list< int > result;
return result;
}
|
if( it_current == it_end ) {
return std::forward_list< int >();
}
|
std::forward_list< int >::const_iterator start = list.begin();
std::forward_list< int >::const_iterator end = list.end();
return foo( start, end, func );
|
return foo( list.cbegin(), list.cend(), func );
|
int resultat;
bool premiere_execution = true;
int argument;
for( auto i : list ) {
if( premiere_execution ) {
argument = initial;
premiere_execution = false;
}
else
argument = resultat;
resultat = func( argument, i );
}
return resultat;
|
for( auto i : list ) initial = func( initial, i );
return initial;
|