Tabs versus spaces in computer programs 2017-04-27 ======================================= Use spaces for indentation and you won't go wrong. ---- Let's explore using tabs. Requirement: We'll want the program to look correctly aligned even if its reader has a different tab width setting from its author's. Solution: Only use a tab when you mean "indent one level". Below, the characters from directly beneath "System" onwards are spaces. To the left of those spaces are tabs. public class C1 { private int a; private int b; public C1() { a=10; b=20; System.out.println("hallo " + "world"); } } Editors may not follow this rule. If you press Enter at the end of the "world" line, an auto-indenting editor may bring you to beneath the opening double quote, but insert tabs all the way upto there. That's too many tabs to satisfy our requirement above. Watch out for such editors. So that's a good rule for languages like Java and C. What about Lisp? The rule is similar. To treat the cdr of a form as having a new level of indentation, start it on its own line: (+ 5 6) or use spaces from the current indentation level onwards, as in the last line of each of these three snippets: (+ 5 6) (some-long-function-name-here 5 6) (defun f (x) (let () (+ x x))) ---- I use spaces not tabs, with these VIM editor settings: ai et ts=2 sw=2