scripting / Scripting-News

I'm starting to use GitHub for work on my blog. Why not? It's got good communication and collaboration tools. Why not hook it up to a blog?
120 stars 10 forks source link

If indenting with spaces, how many? #8

Open scripting opened 7 years ago

scripting commented 7 years ago

I'm ambivalent re code indenting, spaces v tabs.

But, if you are going to do it with spaces, how many spaces should one use??

tedchoward commented 7 years ago

✋ I typically use 2 spaces for indention. I configure it in my editor, and never think about it again.

esfoobar commented 7 years ago

It depends on what language you're using and what editor. For example, Python says "Spaces are the preferred indentation method." ref.

You can easily make your editor insert the correct number of spaces when you hit TAB.

remorse commented 7 years ago

4, unless there are local conventions for something else (e.g., Drupal uses two-space indents).

andrewshell commented 7 years ago

I also use 4 spaces.

When I write javascript I try to adhere to Douglas Crockford's Code Conventions for the JavaScript Programming Language.

tedchoward commented 7 years ago

It's been a long time since I've read Crockford's conventions. I've adopted many of them, but I disagree with some of his points.