If i have a simple chunk of code like:
public void tracePath(){
int steps = 0;
steps = bfs();
if(steps==0){
pathFound(false);
System.exit(0);
}else{
System.out.println(steps);
pathFound(true);
System.exit(0);
}
}
AFAIK this could be rewriten without the else as
public void tracePath(){
int steps = 0;
steps = bfs();
if(steps==0){
pathFound(false);
System.exit(0);
}
System.out.println(steps);
pathFound(true);
System.exit(0);
}
Is there a performance (or other logical) reason so keep (or lose) the else? or is it just (in this example) stylistic choice?