Can anyone help me with curly brackets and semi colans ? I just fail to write a program because i dont know where to insert them | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone help me with curly brackets and semi colans ? I just fail to write a program because i dont know where to insert them

please help me out.

21st Oct 2017, 1:38 PM
Manas Laud
Manas Laud - avatar
2 Answers
+ 6
You haven't mentioned the language. Some programming languages like Python, Ruby etc. do not need semicolons or braces. In general, semicolon should be inserted when a statement is ended. int a = 5; Curly braces indicate a block/body. For example, a block for if-else, loop, function etc. if(a==5){ printf("Five"); b = a; } For the above code, curly braces are creating a block which consists of two statements. Both the statements will execute if a is 5.
21st Oct 2017, 2:53 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 2
; after the end of a statement & curly braces after writing paramaters for functions or while using loops or condition statement.
21st Oct 2017, 2:49 PM
shobhit
shobhit - avatar