+ 1
where we have to use {} and at what disgance ...???
tHis is the problem
2 Answers
+ 2
Curly brackets are used to create a block of code. This is mostly used in if statements in which you have more that one instructions to execute, loops and so on. Basically there is not a limit to how much you can use but the compiler will expect a " } " for each " { " you declare, which basically means that blocks of code can't be left open.
+ 1
We use {} to define the body of a function. It can be used at any distance i. e. it is not customary to write the { in the next line. You can continue it in the same line.