Which is better in general in terms of the ordering? Do you put the fault condition at the top or bottom?
if (noProblems == true) { // do stuff } else { // deal with problem }
OR
if (noProblems == false) { // deal with problem } else { // do stuff }
i like to eliminate error cases first – and return from the function early so that the ‘happy path’ remains un-nested, e.g.
if it is easy to identify the conditions leading to the happy path, then by all means put that clause first (thanks Marcin!)