+ 2
What is the use of semicolons in programs?
5 Answers
+ 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.
+ 2
in some programming languages the ; indicates it is the end of the instructions or code. not all programming languages have the ;
+ 1
Chandan Singh
Semi-colon is used in some programming language to break the statement.
+ 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.
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.