DEV Community


Discussion on: Coding Best Practices, Chapter One: Functions.

kevinhch profile image

Tabs or spaces? :)

omarjalil profile image

Tabs of course

ibrahimisad8 profile image
Ibrahim Isa

Does it matter :)

levivm profile image
Levi Velázquez Author

Sometimes depends on the language being used, sometimes depends on the person. I can't say that there is a Real/Definitive answer but my preference is spaces.

I always map my tab key to spaces. Why? I use python mostly and tabs may vary depending on the system, this could lead to an enormous amount of issues, a space is just one column. Of course, you need to learn how to navigate through the code independently of the selected method to avoid using right/left arrows.

If you use Javascript, this guide made by Airbnb suggest two spaces instead of hard tabs. I consider this a good style guide for ES6 (javascript).

Python == Spaces and so on.

If you share code with other developers, you must agree on a standard no matter your choice.

If you want to use tabs and you are comfortable with it, it's just ok. But, I'm an astronaut(space person ;) )