what is the benefit of the curly brace { } and how to use it in the code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

what is the benefit of the curly brace { } and how to use it in the code

10th Nov 2016, 2:59 PM
Hassan Amr
Hassan Amr - avatar
4 Answers
+ 3
Curly braces are just like what lines are for a map. without lines in a map one wont be in position to tell how do you reach from one place to another. In the same way . an open brace and closed brace tells both the compiler and developer a clear understanding of what was the code written for .
10th Nov 2016, 6:13 PM
jaipal vallabhaneni
jaipal vallabhaneni - avatar
+ 2
you use them when u make a new function, when you make a if statement or for,while loops. with them your app will work corectly also in do{ }while(example: true) or in try{ } catch(exception){ }
26th Jan 2017, 10:24 AM
Catalin Popinciuc
Catalin Popinciuc - avatar
0
Curly braces are used to contain a set of statements. for example: if(some condition) { some statement; }
10th Nov 2016, 4:34 PM
AbdulHaseeb
0
{ } are basically a place holders
18th Mar 2017, 9:37 AM
Rahul Ram
Rahul Ram - avatar