guides:programstyle:whitespace
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| guides:programstyle:whitespace [2020/08/04 17:25] – [Place spaces between operators in statements.] wikiadmin | guides:programstyle:whitespace [2022/08/02 11:59] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 26: | Line 26: | ||
| * **vi** | * **vi** | ||
| * In vi, add //set expandtab// to your .vi, .exrc, vimrc or other | * In vi, add //set expandtab// to your .vi, .exrc, vimrc or other | ||
| + | * **nano** | ||
| + | * In nano, add //set tabstospaces// | ||
| + | * You can also set the size of the indentation with //set tabsize 4// (or whatever size you wish). | ||
| + | |||
| Line 212: | Line 216: | ||
| Proper spacing in statements, especially mathematical calculations make it easier to read these statements. | Proper spacing in statements, especially mathematical calculations make it easier to read these statements. | ||
| + | Unacceptable example: | ||
| <code c++> | <code c++> | ||
| - | |||
| for(i=0; | for(i=0; | ||
| ... | ... | ||
| Line 223: | Line 227: | ||
| </ | </ | ||
| + | Acceptable example: | ||
| <code c++> | <code c++> | ||
| for(i = 0; i < 20; i++) { | for(i = 0; i < 20; i++) { | ||
| Line 232: | Line 237: | ||
| r1 = (-b + sqrt(4*a*c)) / (2*a); | r1 = (-b + sqrt(4*a*c)) / (2*a); | ||
| </ | </ | ||
| - | ==== Do not exceed 80 characters for any line. ==== | + | |
guides/programstyle/whitespace.1596561919.txt.gz · Last modified: 2022/08/02 11:59 (external edit)