Update appNew update is available. Click here to update.

Use of Semicolon in Programming languages

Urwashi Priya
Last Updated: Jan 24, 2023


A semicolon is an announcement separator, not a line separator. A few dialects utilise the new line character as explanation separator.

However, dialects which disregard all white space will, in general, utilise the semicolon. It resembles an accentuation mark sign showing to utilise the stop the line. It is utilised to show the end of guidance in different programming dialects also, similar to C, C++, Java, Javascript and Python.

Function of semicolon in C

  • To stop the line or end the line.
  • It tells that the current articulation has been ended and different proclamations following are new explanations.
  • Use of Semicolon in C will eliminate uncertainty and disarray while taking a gander at the code.
  • They are not utilised in the middle of the control stream explanations however are utilised in isolating the conditions in circling.

Int x = 5;
Int y =10;
Int z = x + y;


Functions of semicolon in C++

  • It is an order in C++.
  • It tells the compiler that it’s arrived at the finish of an order.
  • It is regularly used to delimit the slightest bit of C++ source code, showing it’s purposefully isolated from the particular code.
  • Usage of Semicolon in C++ is after class and structure definitions, variable revelations, work presentations, after every announcement by and large.

Functions of semicolon in Java

  • Java utilisations Semicolon like C.
  • It is a piece of sentence structure in Java.
  • It shows the compiler where guidance closes and where the following guidance starts.
  • It permits the java program to be written in one line or various lines.

Functions of semicolon in Python

  • Python doesn’t utilise them yet it isn’t confined.
  • In Python, it isn’t utilised to signify the stopping point.
  • Python is known as the basic coding language in light of the fact that there is no compelling reason to utilise semicolon and on the off chance that we even neglect to put, it doesn’t toss a blunder.
  • Sometimes Python utilises it as line eliminator.

Functions of semicolon in JavaScript

  • They are discretionary.
  • In JavaScript, there is a cycle called Programmed Semicolon Inclusion (ASI) which embeds a Semicolon at whatever point required yet not set.
  • They are additionally used to end the announcements.
  • Placing the new line close to the past line will bring about legitimate JavaScript which won’t trigger ASI to address it.

Functions of semicolon in Perl

  • Perl language utilises it after each line, aside from toward the finish of the square.
  • Perl lets us discard it since it very well may be utilised as a separator as opposed to an eliminator.
  • Every proclamation in Perl is ended with it except if it is the last line of the program.

Function of Semicolon in SQL

  • In SQL it permits the client to execute the program in a similar call by isolating the announcements in the information base.
  • SQL has an interesting component of adding it naturally to end the announcements.
  • It is an announcement eliminator which is simply used to distinguish the finish of an announcement.

By and large, by taking a gander at the grammar, we can recognise yet utilising it makes it more understood.


Part of Semicolon in C#

  • C# utilises it to dispose of equivocalness and disarray as its use makes the code understood, organised and composed.
  • Like different dialects particularly C and C++, C# additionally adheres to similar standards in its application.
  • The non-attendance of it tosses a mistake by the compiler which must be redressed.
  • It likewise tells the compiler the finish of the announcement.

Function of Semicolon in Scala

  • It assumes an indispensable part in all the programming language by denoting the finish of the announcement.
  • Be that as it may, Scala marks the finish of the announcement as well as the finish of the articulation.
  • Scala’s grammar empowers clear and succinct code, so it is important to utilise it appropriately at whatever point required.
  • Scala adjusts diverse sentence structures like spot punctuation, grammar utilising supports, linguistic structure utilising enclosure and grammar utilising void line separator which replaces the utilisation of the same.

Function of Semicolon in PL/I

  • PL/I is a language which is a progression of assertions and articulations. It is important to isolate the announcements to keep away from uncertainty.
  • Articulations in PL/I ought to be set in discrete lines with it to improve the lucidness.
  • In multi-line proclamations, it is utilised to isolate the lines and in a solitary line explanation, it is utilised to end.

Function of Semicolon in Pascal

  • A semicolon in Pascal goes about as proclamation separator i.e it isolates at least two explanations.
  • Precisely one Semicolon ought to be utilised in isolating two articulations. However, utilising more than one Semicolon (additional Semicolon) will raise a blunder.
  • In contrast to different dialects, Pascal utilises it in an alternate way. There is no requirement for an immediate Semicolon before else in Pascal. Additionally, the last explanation before the finish of the code/program needn’t bother with a Semicolon.
  • Pascal needs it when articulations are written in a grouping.
  • Pascal needn’t bother with Semicolon for a case or a square and furthermore before the catchphrase.

Part of Semicolon in Go language

  • In Go language, it is utilised to isolate the initialiser, condition and continuation components.
  • It is included as an eliminator when the line’s last token is:
  • A number, drifting point, fanciful or string strict one of the catchphrases (eg. break, proceed, return etc..,)
  • An identifier.
  • One of the administrators and delimiters like ++, – , ), ], or }

Frequently Asked Questions

Do all programming languages require semicolons?

No, all programming languages do not require semicolon. Examples of such programming languages are python, ruby and many more.

Is a semicolon mandatory in C++?

Yes, the semicolon is mandatory after each statement in C++.

What type of error occurs when a semicolon is missed in a programming language which mandatorily needs it?

A syntax error occurs during compile time if a semicolon is missed.


It speaks to a break inside a sentence that is more grounded than a comma, yet less last than a full stop. It empowers the author to stay away from overutilisation of the comma and jam the certainty of the full stop. Semicolons are utilised to isolate things in a rundown and to interface firmly related sentences.

To explore more topics to read, click here.

Was this article helpful ?