I've stumbled across both of these methods however I can't decide which one to ultimately go for.
public void myMethod() {
if(isTrue())
return;
// code...
}
Vs.
public void myMethod() {
if(!isTrue()) {
// code...
}
}
Anyone got some exciting news as to which is better practice? I'm just curious as to how people approach this.
Taking a look at Invert "if" statement to reduce nesting explains the readability, however Java != C#
, is there any difference?