Can someone please explain this to me?
They are pretty similar but each has a few special features.
switch
if else
break
goto
It is not really clear how to format switch correctly. Semantically, the cases are jump targets (like labels for goto) which should be flush left. Things get worse when you have curly braces:
case XXX: { } break;
Or should the braces go into lines of their own? Should the closing brace go behind the break? How unreadable would that be? etc.
if-else
if
else
1.4m articles
1.4m replys
5 comments
57.0k users