Learn what programming is all about in this super fast introduction!
Hello and welcome to our free online course "Introduction to programming".
In this course you will learn the basics of programming with
What is kotlin?
Kotlin is the main programming language used to create most Android apps. Once you have learned the basics of Kotlin you can start with Android app development. Also all these basic concepts can be applied to any other programming language.
It's especially similar to
Swift, the language used to make iOS apps.
This makes it easy to switch later on!
Learning by doing
During this course each lesson will consist of some explanation, we try to keep it as short and sweet as possible. And then a lot of practical exercises.
We believe it's best to learn coding by doing. So lets start with your first program!
Every programming instruction starts with a "Hello world" program.
The purpose of this program is to make the computer say:
Take a look at the code. If you press the "Run code" button the program will be executed. After a successful execution the output is displayed underneath the code.
Run the code to see the output!
Hello world explained
Let's take a closer look at the program we just ran. It's a very simple program. Only 3 lines!
No need to worry about
fun main yet. We'll explain that later in
the course. For now just remember that all code you write has to
be within the curly braces
This program writes
"Hello world" to the output. It's doing so using
println() is short for print line
As you might expect given the name, it will print 1 line of text
to the output followed by a return/enter.
The text to print is given between the brackets
After the program is executed, everything written to the output will be displayed underneath the code.
In the code you see the
Hello world program again. For this
exercise you will have to modify it to give the correct output.
To edit the program simply select the text you want to change and start typing.
Change the output of the program by changing the text between the double quotes ("..."). Can you make it say:
Programs are case sensitive so make sure the output matches exactly.
Printing multiple lines
The println function can be used as much as you want. Everytime you use it, it will print a new line to the output.
Can you make a program that writes 2 lines? The output should look like this:
Use the println function multiple times for each line you want to print. Scroll back up to the previous exercise if you forgot the syntax.
Make sure you didn't forget any quotes
(). In this case all outputs should be lowercase.
Programming can be confusing. Sometimes adding some extra information to the code can really help to understand what's happening.
We can add extra text like that with code comments. Code comments can be extremely useful. In this course we'll be using them to add extra explanations to the code. Comments are only for the programmer and are completely ignored by the computer.
There are two ways to add a comment:
// this is a single line comment /* This is a multiline comment everything between /* */ is a comment. */
See the code for some examples. As you can see comments are displayed in green (In this course).
You wrote your first lines of code and learned how to write output! You also learned how to add comments to your code. Continue to the next lesson to get started with variables.
Kotlin is the main programming language used for making Android apps.
If we want to see the results of a program we have to run or execute it. Both terms can be used interchangeably.
Every program has a text output channel.
println()is used to write text to the output channel.
Code comments are used to explain programmers what a piece of code is for. Comments are not executed and the computer ignores them.