Hacker News new | past | comments | ask | show | jobs | submit login

[2] For me it has to do with scanning code. If if-statements are always in a block, then I can easily scan to or past it without having to stop and read what it actually says. But, if it is in a single line I have to stop and read it to understand that it is actually an if statement that was put onto a single line.



I've made the mistake of trying to add an extra statement to a one-line if and forgetting to add a block too many times. Although now GCC has -Wmisleading-indentation which should catch that.


Yes, exactly, it's just not worth the risk. It gets worse with preprocessor macro systems like C has, where something might look correct until you follow the macro definition.


Username checks out




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: