Braces or indentation ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

Braces or indentation ?

Do you prefer to use braces or indentation and which one do you think is cleaner ?

4th Apr 2018, 11:45 AM
Amine Trabelsi
Amine Trabelsi - avatar
38 Answers
+ 20
Braces enforced, with proper indentation encouraged. Actually, either one is fine for me, just not both braces and indentations enforced together as a part of the syntax.
4th Apr 2018, 12:46 PM
Hatsy Rei
Hatsy Rei - avatar
+ 21
When I started to write in Python, I thought: 'I want to use braces!', now I fell good with indentation. I prefer this because braces can create confusion with other braces that you use for functions, lists, sets, ecc.
4th Apr 2018, 3:25 PM
Giuseppe Pipitò
+ 17
Indentation. Its is hard to find missing braces. Also indentation makes the program look alot more clean. Python
5th Apr 2018, 6:27 AM
Mitali
Mitali - avatar
+ 16
I prefer braces with auto-indent or beautifier. That makes it easy to identify matching braces. "Newer" editors also highlight matching braces when near one of them and the whole section can be collapsed.
8th Apr 2018, 12:42 AM
Modi
Modi - avatar
+ 7
You should always indent, no matter if you have braces or not. As for braces, I don't care a lot. I like the cleanliness of Python, but missing braces are a lot easier to find than wrong indentation. I guess I like them.
4th Apr 2018, 1:13 PM
Chris
Chris - avatar
+ 6
I find braces more easy and less error prone.
4th Apr 2018, 11:59 AM
Bishal Sarang
Bishal Sarang - avatar
+ 4
braces
4th Apr 2018, 4:35 PM
André Patacas
André Patacas - avatar
+ 4
Braces are most cleaner than indentations.Braces represent blocks and are more easier yo understand than indentations.Some people just use only one space as indention and It is very annoying to check the scope of variables in the blocks.So in my opinion,braces are more cleaner than indentations.
5th Apr 2018, 4:43 PM
®️ahul Mathews™️
®️ahul Mathews™️ - avatar
+ 4
indentation is mandatory in both cases . . . . as every code has to be clean
8th Apr 2018, 2:49 PM
Johnnie 🎩
Johnnie 🎩 - avatar
+ 3
proper indentation
4th Apr 2018, 5:10 PM
Arslan Malik
Arslan Malik - avatar
+ 3
Indent .
4th Apr 2018, 7:48 PM
1337 H4x0r
1337 H4x0r - avatar
+ 3
I think that indentation is a good practice in every language, and I also suggest the use of braces, but it is a language dependent concept
4th Apr 2018, 10:43 PM
GeekDandi
GeekDandi - avatar
+ 3
Either works if you care about the code clarity. Neither will help if you don't.
5th Apr 2018, 3:15 PM
Denys Yeromenko
Denys Yeromenko - avatar
+ 3
Braces might just clutter up your code, making it hard to read. So proper indentation is very useful
7th Apr 2018, 1:52 PM
Paul Grasser
Paul Grasser - avatar
+ 3
braces
7th Apr 2018, 5:42 PM
shivam sharma
shivam sharma - avatar
+ 3
I believe that braces are better but a code with no indentation at all wouldn't be very clear so they work nicely together
8th Apr 2018, 5:53 PM
Uni
Uni - avatar
+ 2
A combination, braces allow you to easily see what code belongs to what function whilst indentation helps you to see how embedded it is in oher things.
6th Apr 2018, 6:39 AM
Zack
Zack - avatar
+ 2
Braces + indentation. That's the way we can read and work easily on a block of code.
6th Apr 2018, 1:33 PM
Boris Batinkov
Boris Batinkov - avatar
+ 2
Braces, though I'm fine with both. Basically like Hatsy.
6th Apr 2018, 3:00 PM
LunarCoffee
LunarCoffee - avatar
+ 2
Braces but conventionally one can opt both
6th Apr 2018, 6:26 PM
Omkar Kumbhojkar
Omkar Kumbhojkar - avatar