17

Who the hell thought that spaces OR tabs for indentation was an option?
For Spaghetti Monster's sake. An space is to separate words, one at a time. Tabs are for indents.
PERIOD
.

Comments
  • 3
    2 spaces, anything else is just a penis extension
  • 6
    Tabs ruin formatting
  • 2
    2 or 4 spaces can very well indent code

    welcome to devrant

    PERIOD
  • 1
    Four spaces
  • 7
    Only people using vim or notepad have this problem.
    Any half-baked IDE will indent automatically.
  • 0
    @ScriptCoded explain why every ide autoformats code according to tabs then? lol
  • 3
    Two spaces.
    Three and four are also okay. Tabs are not.
  • 3
    @NoToJavaScript ? Vim indents automatically. Why wouldn't it?
  • 0
    @OMGitsOLE First of all, not all IDEs do. In my experience it's actually most of the older ones. Secondly, just because most people in the world runs Windows that doesn't mean it's a superior OS. The same goes with default preferences in IDEs
  • 2
  • 1
    @Monk and then all the project files only look nice in IDEs. Right? Because other text editors have their own understanding of tab length. Cat'ing files to terminal is also not considered
  • 1
    I personally like tabs

    PERIOD
    .
  • 1
    This is such a formatting partisan debate. We should combine tabs and spaces. The new character should be called spabs. It will be a compromise between space supporters and the dumb fucks that support tabs.
  • 3
    Tabs for indentation, spaces for alignment. That's a huge difference!
  • 1
    @ScriptCoded why? How? I'm honestly curious
  • 1
    @sirjofri my lord! I have found thee!
  • 1
    @Demolishun goddamn that is an absolutely perfect use of the Picard four lights thing.
  • 1
    @epse Why how what?
  • 0
    I don't get it. I was always taught to set my editor so that tab key creates 4 spaces. Is this wrong, and why if so?
  • 1
    @ScriptCoded sorry, why do tabs ruin formatting?
  • 2
    Indentation is a personal preference. So if you indent with spaces, other users feel uncomfortable reading your code. Indent with tabs and the personal editor of the reader will display it correctly.
    Alignment is for readability of similar lines following each other. You can use it perfectly for aligning the equal signs of variable assignments. You can assume that devs use monospace font, so aligning those things with spaces is totally fine and it's displayed correctly in all editors (using monospace fonts)
  • 0
    @lkjhgf253 I wouldn't say it's "wrong". Also companies have their own guidelines, so better use that at work (and if they use spaces, well, use spaces, too. Remember it's about readability)
  • 1
    @epse First image I found. Aligning function arguments for example. That won't show equally for someone with a tab size of 2 vs 4
  • 1
    @ScriptCoded aaah yes for aligning I'm absolutely with you
  • 2
    @epse Whops, should've been an image there too.
  • 2
    @ScriptCoded I think that image doesn't get the point of a tabstop? A tab character isn't a constant width, but it aligns the next character to the next column of the width that you set your tab widt to
  • 2
    @epse Yeah, that isn't the best image. Just wanted to show what I meant by formatting. Ignore the tab marks :)
  • 1
    @ScriptCoded I get your point, if you want to align shit spaces are fine
Add Comment