
At Stewart Roberts, about "embedded if else" vs "Breakable idiom". (I answer in a separated mail, because this may also interest other people, more than the previous one). You proposed the "embedded if{}else{}" solution. If I was fully pleased with it, I would not have dare to propose the 'Breakable' idiom solution :-). My concerns are : 1 When you are embedding if/ else, you got quickly more tabs/space to manage. 2 When you are embedding more than 4 if/else, you have to be more careful to the right side of your line. Nobody like to scroll left right, and it is harder to print or display on your website ^^. Even more if you got a 10' screen. 3 When you are using the 'Breakable' idiom, your code is vertically structured, and looking extremely homogeneous. 4 With the 'Breakable' idiom, 'else' is implicit. As a consequence, you will have less lines (unless you are using "}else{" like unix user, in which case it is the same length). 5 The "test", "fail case" and the "ok case" looks more contiguous. These are not separated by the other tests or the "}else{". There are less "visuals parasite" between them. Have a look : if(t1) { if(t2) { if(t3) { if(t4) { if(t4) { } else { } } else { } } else { } } else { } } else { } Breakable { if(!t1) { break; } if(!t2) { break; } if(!t3) { break; } if(!t4) { break; } if(!t5) { break; } } You can also imagine 1 or 2 lines of code between each test and case, to get an idea of the use. 6 The breakable code is easier to maintain : you can add a test and a else without "re-tabbing" the code, and also without needing to scroll up/down to make the visual correspondance between a "if " and a "else" that are separated by 4 tests. As a consequence, I consider The 'Breakable idiom' often improves readability for theses tasks, over the embedded if{}else{}. Also, compared to the expanded version (for(bool executed=false; executed!=true; executed =true) or do{...}while(false), the 'Breakable macro' tells why it is here : it suppresses doubts. I suppose most of my coworker would ask me why there is a "do{...}while(false)" in some code, while on the contrary, it took them no pain to understand the use and the meaning (when they read it in someone else code) of the macro. Thanks for your time, Best regards, Pierre Morcello