DEV Community

Si for CodeTips

Posted on • Originally published at codetips.co.uk on

What are data-types?

A bit of information (data) always has a certain type

What are data-types?

Each programming language has different data-types or names them differently, but most of them have a variation of these four:

Booleans

Booleans are simple binary values (true or false).

isTrue = true
isFalse = false
Enter fullscreen mode Exit fullscreen mode

In our previous article about if statements we showed you how programs determine between executing a block of code or not. The condition that is used for this can ultimately only have two outcomes: do it (true) or don't do it (false).

Integers

Integers are whole numbers (with no decimal places).

number = 5
Enter fullscreen mode Exit fullscreen mode

Floats

Floats are numbers that can have decimals, but do not always have to.

number = 3.5
Enter fullscreen mode Exit fullscreen mode

Strings

Strings are simply a series of characters (like words, names or whole sentences)

id = ckjasdiwe98213
name = John
lastname = Doe
job = John is working at a farm, growing potatoes
Enter fullscreen mode Exit fullscreen mode

Top comments (0)