In the last blog we have seen that a Semi Colon (;) is used to end a command line in C++.

So can we RUN a program which never uses a semi colon?

If you think it’s Possible, You are damn right!!===>Coding is FUN

In this blog we shall learn about “Hello World” Program which uses NO semi colon.

Look carefully into this Screenshot.


You can find NO Semicolon used in the program.

So what?

It still gives the desired output of a Hello World Program.

This is one of the simplest of the simplest ways to write the CODE without semi colon.

Now lets understand what all things I have made use of in this Code.

I have used an entirely different header file and a new function this time.

As we have understood how COUT in iostream can do, we can write this code using it too.

But we should have the knowledge of what this if statement can do.

Now we shall learn about if If is a Selection statement.

The if keyword is used to execute a statement or block, if, and only if, a condition is fulfilled. Its syntax is:

if (condition) statement

i.e If what we give in the brackets (condition) comes to be true,i.e. it returns a ‘high’ value in Binary,

statement1 will be executed, otherwise it will skip all statements given in the braces after if statement.

If statement doesn’t need a semi colon!

In our Code, the statement is:

  • if(printf("HelloWorld")
  • {}

printf does just like cout does,even though they are defined in different header files (stdio.h and iostream.h respectively).

When the compiler encounters an if statement it directly goes to the condition given in the statement.

i.e. it executes printf(“HelloWorld”) 

After this is executed correctly since it returns a 1(High value),

There are No statements inside the braces so Nothing is done there.

That’s all

You have learnt a bit about C++ and a few functions.

First thing you have to do is practice.

You may try replacing “printf” function with any other you have learnt.

If you get the result,Yippeee! You are doing great.!!

Comment if you have any Queries.

As I told, this is the simplest of the simplest ways to solve this Code,

You may try to get more Codes which does the same and comment below! Happy Coding!!