fix markdown
This commit is contained in:
parent
d14d21a4e8
commit
452115d07b
|
@ -39,14 +39,14 @@ Nim also has semicolons. They are redundant as simple statement terminators, but
|
|||
|
||||
In 'curly braces languages', indentation works like comments. You will put it to make the code understandable, but its meaning is not enforced by the compiler/interpreter and thus can get out of sync with the real meaning, defined by the braces, or lack of it. This can lead to dangerously ambiguous code (for humans to understand, of course). For example (from ["Python: Myths about Indentation"](http://www.secnetix.de/~olli/Python/block_indentation.hawk)):
|
||||
|
||||
>```C
|
||||
```C
|
||||
if (some condition)
|
||||
if (another condition)
|
||||
do_something(fancy);
|
||||
else
|
||||
this_sucks(badluck);
|
||||
```
|
||||
> Either the indentation is wrong, or the program is buggy, because an "else" always applies to the nearest "if", unless you use braces. This is an essential problem in C and C++. Of course, you could resort to always use braces, no matter what, but that's tiresome and bloats the source code, and it doesn't prevent you from accidentally obfuscating the code by still having the wrong indentation. (And that's just a very simple example. In practice, C code can be much more complex.)
|
||||
Either the indentation is wrong, or the program is buggy, because an "else" always applies to the nearest "if", unless you use braces. This is an essential problem in C and C++. Of course, you could resort to always use braces, no matter what, but that's tiresome and bloats the source code, and it doesn't prevent you from accidentally obfuscating the code by still having the wrong indentation. (And that's just a very simple example. In practice, C code can be much more complex.)
|
||||
|
||||
### Tabs vs Spaces
|
||||
|
||||
|
|
Loading…
Reference in New Issue