1
00:00:00,600 --> 00:00:07,170
OK, let's continue this lecture with conversions, so why we need conversion, because when you add

2
00:00:07,170 --> 00:00:14,700
up numbers or multiply or you need a smaller data type, you convert it into another type.

3
00:00:14,730 --> 00:00:17,100
There are two types of conversions.

4
00:00:17,430 --> 00:00:23,370
Widening and narrowing, automatic or widening conversion is easy.

5
00:00:23,750 --> 00:00:26,250
Imagine variables as boxes.

6
00:00:26,490 --> 00:00:29,370
Byte is a small box short.

7
00:00:29,520 --> 00:00:30,440
It's a bigger one.

8
00:00:31,050 --> 00:00:37,600
You can easily put the content of a small box into a bigger box as we go along.

9
00:00:37,830 --> 00:00:43,410
It's easy to see why we can convert upwards in case of load and double.

10
00:00:43,410 --> 00:00:45,610
We use it to store along.

11
00:00:45,810 --> 00:00:51,450
The other way is explicit conversion or narrowing while it's not too pleasant.

12
00:00:51,840 --> 00:00:56,790
We have to put the content of a bigger box into a smaller one.

13
00:00:56,970 --> 00:01:00,220
We can lose data here which can cause problems.

14
00:01:00,240 --> 00:01:08,430
So as when we go downwards, we have to use the following form first the desired data type, then the

15
00:01:08,430 --> 00:01:16,860
new variable name equals the desired data type in parentheses, then a value like thousand or three

16
00:01:16,860 --> 00:01:20,890
hundred or two or another variable name.

17
00:01:21,630 --> 00:01:23,610
We also call this casting.

18
00:01:23,910 --> 00:01:28,170
Right, and I think it's easier to see how it works in practice.

19
00:01:28,170 --> 00:01:29,670
So let's do some coding.
