+ 2

What is the use of semicolons in programs?

31st Aug 2021, 12:34 AM
Chandan Singh
5 odpowiedzi
+ 2
Could you explain what ur exact question is? What I get is that you want to know what the ";" in for example java means. It is important for the code structure. The compiler uses them to correctly interpret your source code. for example: int test = 4 int test1 = 5; The compiler will ignore white space and try int test = 4int test1 = 5; as you can see this makes no sense for the compiler and he will throw an error. Different Languages use different Code Syntax. Java and C languages heavily rely on ';' and '{}' While python takes a completely different approach and relying on line breaks and tabs.
31st Aug 2021, 12:45 AM
Lennart Krauch
Lennart Krauch - avatar
+ 2
in some programming languages the ; indicates it is the end of the instructions or code. not all programming languages have the ;
31st Aug 2021, 1:06 AM
you are smart. you are brave.
you are smart. you are brave. - avatar
+ 1
Chandan Singh Semi-colon is used in some programming language to break the statement.
31st Aug 2021, 2:35 AM
A͢J
A͢J - avatar
+ 1
Generally, semicolons are used for separating the code lines are running. Especially, some programming languages wants semicolon each line/code ends for separating running code blocks and if they aren't used, error occurs. But some others don't need semicolon and they can use it in special cases. In C, we always use a semicolon when we write some variables, some equations, some calculations... C always wants semicolon for separating lines, code blocks. In Java, we don't have to write semicolon each line. But we can use it in some cases, lines, blocks. In python, again we don't need to use semicolon. Just remaining special cases.
1st Sep 2021, 12:05 AM
mesarthim
mesarthim - avatar
0
The semi colon is “separater”. The simple answer is to tell the compiler that which line of code is separate each other then you get the desired output otherwise if you not use ; then compiler think all line are one and then confused and gave the many errors and errors.
31st Aug 2021, 6:52 AM
Arun Jamson
Arun Jamson - avatar