I wrote a simple if/else
in my code which worked fine. Later I added another level of if
under the first, and was baffled by its behavior. Here\'
Is there a way to make the above code do what the indentation makes you expect without adding braces?
if (a)
if (b)
System.out.println("a=true, b=true");
else;
else
System.out.println("a=false");
else;
will definitively finish the innermost if.
I would like to note that, if I ever came across this code in production, I would hunt through the commit logs until I found out who wrote it. This is absolutely an unacceptable thing to do. but it answers the quoted question