• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 19:14
CET 01:14
KST 09:14
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
BGE Stara Zagora 2026 announced11[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge2
StarCraft 2
General
BGE Stara Zagora 2026 announced SC: Evo Complete - Ranked Ladder OPEN ALPHA When will we find out if there are more tournament Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge
Tourneys
RSL Revival: Season 3 Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death
Brood War
General
BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ A cwal.gg Extension - Easily keep track of anyone Which season is the best in ASL? soO on: FanTaSy's Potential Return to StarCraft
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Nintendo Switch Thread The Perfect Game Stormgate/Frost Giant Megathread Beyond All Reason Should offensive tower rushing be viable in RTS games?
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread The Big Programming Thread Things Aren’t Peaceful in Palestine Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2487 users

Programmers - How many spaces do you indent?

Blogs > Xanbatou
Post a Reply
1 2 3 Next All
Xanbatou
Profile Blog Joined February 2010
United States805 Posts
Last Edited: 2011-08-30 19:01:45
August 30 2011 18:45 GMT
#1
Hello fellow Computer Scientists/Programmers!

I was curious about the indenting style most people use. I have used 4 spaces for a long time, because I like how clear it makes things. If lines start to get too long with 4 spaces, I feel like you have bigger concerns than your indentation width .

Recently I started programming in Erlang using code written by another developer as an example. I noticed he liked to code with 2 spaces, which I don't think is enough personally. How much do you guys indent?

Poll: How many spaces do you indent?

4 (50)
 
59%

2 (20)
 
24%

5 (5)
 
6%

3 (4)
 
5%

1 (3)
 
4%

8 (2)
 
2%

7 (1)
 
1%

6 (0)
 
0%

85 total votes

Your vote: How many spaces do you indent?

(Vote): 1
(Vote): 2
(Vote): 3
(Vote): 4
(Vote): 5
(Vote): 6
(Vote): 7
(Vote): 8



EDIT AND WARNING: I would hope most of you would know this, but do NOT use tabs unless you make sure that whatever editor you are using converts them into spaces first. Tabs are not good to use...

*
Grobyc
Profile Blog Joined June 2008
Canada18410 Posts
August 30 2011 18:49 GMT
#2
I don't know if you've seen this already or not, but this might be worth posting in here:
http://www.teamliquid.net/forum/viewmessage.php?topic_id=134491
If you watch Godzilla backwards it's about a benevolent lizard who helps rebuild a city and then moonwalks into the ocean.
ComaDose
Profile Blog Joined December 2009
Canada10357 Posts
August 30 2011 18:54 GMT
#3
I use tabs
Or 4.
BW pros training sc2 is like kiss making a dub step album.
huameng
Profile Blog Joined April 2007
United States1133 Posts
August 30 2011 18:56 GMT
#4
4 spaces is the standard I think. I highly recommend it.
skating
myzael
Profile Blog Joined November 2008
Poland605 Posts
August 30 2011 18:58 GMT
#5
I use 4. I started this way and now I don't even consider it. I you dislike someone's style of indentation why not configure your IDE to convert them on pull and reconvert on commit?
Frozenhelfire
Profile Joined May 2010
United States420 Posts
August 30 2011 18:58 GMT
#6
I thought everyone used the tab key. I use the tab key. In what case would not be using the tab key be appropriate and/or better?
polar bears are fluffy
Xanbatou
Profile Blog Joined February 2010
United States805 Posts
August 30 2011 19:00 GMT
#7
On August 31 2011 03:58 myzael wrote:
I use 4. I started this way and now I don't even consider it. I you dislike someone's style of indentation why not configure your IDE to convert them on pull and reconvert on commit?


Because it doesn't bother me that much and I'm not using an IDE. I'm on linux using gedit .
Talin
Profile Blog Joined September 2010
Montenegro10532 Posts
Last Edited: 2011-08-30 19:08:59
August 30 2011 19:07 GMT
#8
I use 4, it's N++'s default and it works best with Python imo. I do use tabs actually, never really had any problems with that (Notepad++ automatically tab-indents with Python).
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
August 30 2011 19:13 GMT
#9
In most editors, I set tab to 4 spaces. In Notepad2 I use 2 spaces for web-oriented languages.
Torenhire
Profile Blog Joined April 2009
United States11681 Posts
Last Edited: 2011-08-30 19:15:04
August 30 2011 19:14 GMT
#10
if( spaces == 4 )
{
spaces = perfect;
}
else
{
programmer sucks
}
SirJolt: Well maybe if you weren't so big and stupid, it wouldn't have hit you.
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
August 30 2011 19:28 GMT
#11
why would anybody not use tabs? as long as you use the same indentation character throught your code, why not use tabs? I actually set my IDE up to only use tabs, because i really dislike having 16 different text cursor positions in front of my code instead of just 4, which actually are at exactly the spots where i could want to move indented code to. Using multiple spaces instead of single tabs requires a lot more micro management when selecting passages by mouse or keyboard properly, why would anybody prefer that?
Gold isn't everything in life... you need wood, too!
Xanbatou
Profile Blog Joined February 2010
United States805 Posts
August 30 2011 19:34 GMT
#12
On August 31 2011 04:28 MisterD wrote:
why would anybody not use tabs? as long as you use the same indentation character throught your code, why not use tabs? I actually set my IDE up to only use tabs, because i really dislike having 16 different text cursor positions in front of my code instead of just 4, which actually are at exactly the spots where i could want to move indented code to. Using multiple spaces instead of single tabs requires a lot more micro management when selecting passages by mouse or keyboard properly, why would anybody prefer that?


People avoid using tabs because it doesn't look the same in every editor.
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
August 30 2011 19:35 GMT
#13
On August 31 2011 04:28 MisterD wrote:
why would anybody not use tabs? as long as you use the same indentation character throught your code, why not use tabs? I actually set my IDE up to only use tabs, because i really dislike having 16 different text cursor positions in front of my code instead of just 4, which actually are at exactly the spots where i could want to move indented code to. Using multiple spaces instead of single tabs requires a lot more micro management when selecting passages by mouse or keyboard properly, why would anybody prefer that?


Because when viewed under different editors (you might not be the only one viewing the code) there may be different tab display settings in those editors, and you could end up with some horrendously misaligned stuff.
Cambium
Profile Blog Joined June 2004
United States16368 Posts
August 30 2011 19:36 GMT
#14
Depends on the screen of myself and whoever is reading the code.

On a 19", I use 2.

If I have a 24" wide-screen, I use 4.
When you want something, all the universe conspires in helping you to achieve it.
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
August 30 2011 19:37 GMT
#15
Why did people ever use 8 back in the day anyways. Sounds horrible.
Osmoses
Profile Blog Joined October 2008
Sweden5302 Posts
August 30 2011 19:37 GMT
#16
I use tabs, and whenever my me and my co-workers go into the same files and muck around the result is always the end of virtue and the triumph of malignant chaos. Cba to fix.
Excuse me hun, but what is your name? Vivian? I woke up next to you naked and, uh, did we, um?
Talin
Profile Blog Joined September 2010
Montenegro10532 Posts
Last Edited: 2011-08-30 19:41:36
August 30 2011 19:40 GMT
#17
One would expect that people working together would make sure that problems with editor differences don't ever occur.

Seems a lot easier to do than pressing space space space space (at least!) every line. If I started doing that, it would kill me. -_-
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
Last Edited: 2011-08-30 19:43:11
August 30 2011 19:41 GMT
#18
why would anything misalign if you use tabs? if you need to draw ascii arts into your code, make spaces from where the default indentation ends at these lines, obviously don't use tabs inside "drawings". But for normal indentation tabs are perfectly fine.

and seriously, are there still people who are incapable of setting up their tab displaying today? i mean, you don't have to use the windows editor for programming anymore, anyone who does and actually feels like he really has any reason to complain about that .. well, i wouldn't want someone like that touching my code anyways xD

i would value usage comfort higher than compatibility with people who cannot set up their editors properly. Sure, spaces are more compatible, but they are just a lot more inconvenient. And working around the incompatibility should no be a problem for anybody, so that surely does not outweigh the increased comfort when using tabs?

/edit:

On August 31 2011 04:40 Talin wrote:
One would expect that people working together would make sure that problems with editor differences don't ever occur.

Seems a lot easier to do than pressing space space space space (at least!) every line. If I started doing that, it would kill me. -_-


you actually don't type "space space space space", you type "tab" and your editor just writes down 4 spaces instead. But any editor that can do that is pretty much guaranteed to have tab display settings, so you might as well use tabs.
Gold isn't everything in life... you need wood, too!
Cambium
Profile Blog Joined June 2004
United States16368 Posts
August 30 2011 19:43 GMT
#19
Tabs don't work well because different people prefer different IDEs/editors and operating systems, so it's almost impossible to use tabs. Also, most diff tools don't work well with tabs from different OS.

Just because you use 4 spaces, it does not mean you have to press 'space' 4 times. Most IDEs offer you the option to use "soft tabs" which converts tabs to spaces automatically.
When you want something, all the universe conspires in helping you to achieve it.
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
August 30 2011 19:46 GMT
#20
On August 31 2011 04:41 MisterD wrote:
why would anything misalign if you use tabs? if you need to draw ascii arts into your code, make spaces from where the default indentation ends at these lines, obviously don't use tabs inside "drawings". But for normal indentation tabs are perfectly fine.

and seriously, are there still people who are incapable of setting up their tab displaying today? i mean, you don't have to use the windows editor for programming anymore, anyone who does and actually feels like he really has any reason to complain about that .. well, i wouldn't want someone like that touching my code anyways xD

i would value usage comfort higher than compatibility with people who cannot set up their editors properly. Sure, spaces are more compatible, but they are just a lot more inconvenient. And working around the incompatibility should no be a problem for anybody, so that surely does not outweigh the increased comfort when using tabs?

/edit:

Show nested quote +
On August 31 2011 04:40 Talin wrote:
One would expect that people working together would make sure that problems with editor differences don't ever occur.

Seems a lot easier to do than pressing space space space space (at least!) every line. If I started doing that, it would kill me. -_-


you actually don't type "space space space space", you type "tab" and your editor just writes down 4 spaces instead. But any editor that can do that is pretty much guaranteed to have tab display settings, so you might as well use tabs.


In a sidenote, if I ever want to edit an html file through the web editor in cpanel, it looks horrendous whenever I tabbed instead of soft tabbed. Quite an eyesore.

But I usually just ftp that shit and use Notepad2, so it doesn't really matter very much in this case.
1 2 3 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 9h 47m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft602
StarCraft: Brood War
NaDa 71
ivOry 13
Dota 2
syndereN785
monkeys_forever8
Counter-Strike
minikerr52
Other Games
summit1g14641
Grubby6141
Mew2King143
ToD74
ViBE51
Organizations
Other Games
gamesdonequick2387
Dota 2
PGL Dota 2 - Main Stream188
Other Games
BasetradeTV106
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• HeavenSC 114
• musti20045 30
• davetesta28
• Hupsaiya 14
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• blackmanpl 40
• RayReign 23
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota22532
League of Legends
• Doublelift3105
Other Games
• imaqtpie2048
• tFFMrPink 7
Upcoming Events
Sparkling Tuna Cup
9h 47m
WardiTV Korean Royale
11h 47m
Zoun vs SHIN
TBD vs Reynor
TBD vs herO
Solar vs TBD
BSL 21
19h 47m
Hawk vs Kyrie
spx vs Cross
Replay Cast
23h 47m
Wardi Open
1d 11h
Monday Night Weeklies
1d 16h
StarCraft2.fi
1d 16h
Replay Cast
1d 23h
Wardi Open
2 days
StarCraft2.fi
2 days
[ Show More ]
PiGosaur Monday
3 days
Wardi Open
3 days
StarCraft2.fi
3 days
Replay Cast
3 days
The PondCast
4 days
Replay Cast
4 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
SC Evo League
6 days
BSL 21
6 days
Sziky vs OyAji
Gypsy vs eOnzErG
Liquipedia Results

Completed

SOOP Univ League 2025
RSL Revival: Season 3
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.