Home Syntax and semantics Variables and data types If- and switch-statements For- and while-loops Functions Programming product SQL

Variables and data types

To do:

Watch the videos below and learn about the different datatypes.
When you are done, then play around with them. For example, you could print out information about yourself; age(int), height(float), name(string), if you like programming or not (bool).
Document your creation and your knowledge about data types on your studieweb.

Int:
Stands for integer. An integer is a whole number, it can be 2, 5 or 7, but it can also be negatives like -4, -5 and 0.


Double and float are both floating-points. Floatng-point numbers are anything with a fractional part, like 2.4 or 5.5.


Det her er eksempel fra Emils programmering

My example


In my example:

As you can see my name is string, because it's a sequence of an amount multiple characters.
Int was used for my age, because it's a whole number,
Float was used for my height, because it's a fractional number,
but it's not a very complicated one so there's no need for double.
And finally bool was used for the last sentence, because it was a true or false statement.