Ask coding questions

← Back to all posts
Tabs or Spaces?
h
JoeyRueff (28)

This is arguably one of the most controversial questions, but I need answers. Tabs or Spaces?

Comments
hotnewtop
DynamicSquid (4621)

Tabs or spaces? If you're coding on VS and press space four times, then go home.

DungeonMaster00 (179)

Tabs because it's easier to read.

Haizi (8)

Tabs are four spaces saving time and tabs are not that annoying like spaces go tap tap tap tap while tabs are just tap.

ETHANTHOMAS9 (49)

I have a bad habit of using spaces lol don't burn me at the stake

CodeLongAndPros (1596)

My tab key actually inserts two spaces.

In my ~/.vimrc:

set softtabstop=2 shiftwidth=2 expandtab
PowerCoder (733)

TABS!

Pressing tabs saves time!

DynamicSquid (4621)

@PowerCoder huh?

#include <iostream> using namespace std; class Point { public: static int number; }; int Point::number = 0; int main() { std::cout << Point::number << "\n"; }

EpicGamer007 (1606)

Repl's default is two spaces and I do not hate it but tabs are the way to go (This is my Opinion)

Codemonkey51 (1049)

Default on repl is 2 spaces

Also:

SPACES BEST

DynamicSquid (4621)

@Codemonkey51 so you press space every time?

Codemonkey51 (1049)

Nope return(enter) auto does it on most ide's @DynamicSquid

CodeLongAndPros (1596)

@DynamicSquid

so you press space every time?

Any good editor lets you press the <tab> key and insert spaces.

DynamicSquid (4621)

@CodeLongAndPros, @Codemonkey51 I know, but were talking about in a situation like this:

void function()
{
int var;
}

Do you press space or tab?