When do you use ";'s" (semi-colons)


When do you use semi-colons. Not all lines have a semi-colon at the end of the line.


First of all it depends on the language you are using.
There are languages that don’t use semicolons think about “Python” for example and also languages that still run when not using them “Javascript” for example.

If you do use a language that uses semi colons, than the semicolon usually means that its the end of a line that has to be executed.
for example (pseudo code):"

foo = 2;
bar = 3;
if (foo == bar){
  print "foo has the same value as bar";

As you can see the if statement does not need a semicolon since its only a check.
The print on the other hand has to do something. namely printing out the result to the screen.
Lastly setting variables need semicolons as well since here your also asking the computer to do something.