All you need to write a program that every computer will understand are a few commands that are very similar to a short English sentence. Let’s take a look at this example:

if sunny then

print “have a nice day”


print “don’t forget your umbrella”


This fragment of code is a conditional statement called an “If Statement” which is built into almost every programming language just like many other similar English-based commands. 

Our program asks whether it is sunny and if it is, prints a nice greeting, otherwise, it reminds you to carry an umbrella in case it rains. We just need to input whether it is sunny outside or not.

print is another command and its job is to show characters in the output window.

Quotation marks tell the compiler to treat everything inside as text, not code.

And that’s it. We just wrote our first program.

Note: if, else, endif, print commands are present in all modern programming languages. They just might require a slightly different syntax, for example, print in some languages could be printf(“hello”);
or an if statement might require curly braces, but these are just minor differences that can be easily found in the language documentation. The important thing is that the program above will run in almost all compilers with minimum adjustments.

Next page ->

Leave a comment

Your email address will not be published. Required fields are marked *