3 ms·
The issue with the optional curly brackets is that for new users, or even experienced users reading through code quickly is that at first glance: if(someth
by Macha 14y ago
The issue with the optional curly brackets is that for new users, or even experienced users reading through code quickly is that at first glance:
if(something)
doSomething();
And:
if(something)
doOneThing();
doAnotherThing();
Both look like they should execute the same way - running the indented code if the condition is true. The reason this is a problem in C and not in python is that in python, this code operates as it intuitively looks, while in C, it does not.
(It can trip up experienced users if they're not paying enough attention and their mind just assumes the curly brackets are there.)
- artsrc 14y agoThe issue is that: * Humans use indentation * The Compiler ignores indentation * The indentation and the the compilers interpretation are different