3 ms·
Yeah, it seems like this is something many newer languages are requiring, which is good. Go requires braces as well.
by Jayschwa 13y ago
Yeah, it seems like this is something many newer languages are requiring, which is good. Go requires braces as well.
- lmm 13y agoRequiring braces is the wrong solution to the problem. It's the indentation that misleads here; indentation is what people look at to see what's part of which if, so have the language look at the same thing, like Python does.
- emmelaich 13y agoIndeed, but I wonder if indenting would have helped here. Two gotos immediately after one another at the same indentation level is obviously wrong by visual inspection. Proper indentation might have led the casual viewer to think that the code was actually ok!
- micro-ram 13y agoI use Astyle to enforce both braces and indentation automatically. http://astyle.sourceforge.net/ http://astyle.sourceforge.net/
- rwallace 13y agoThat's the thing - with an indentation-based syntax, the code would have been okay! The second goto would have been part of the if statement, so it would have had no effect beyond the aesthetic.