Is it generally accepted to be better programming practice to use a structure like:
if (x == 1) {
if (y != 1) {
[code]
}
}
or to use a guard like this:
if (x == 1) {
if (y == 1) return;
[code]
}
The first style has a more logical structure, where it's clear at a glance which code depends on what.
But the second style results in a more simple visual style and fewer lines of code.
Is the second style considered a bad habit? Or is it just a style choice?
[update] this is a duplicate