1
00:00:00,390 --> 00:00:01,110
Welcome back.

2
00:00:01,140 --> 00:00:08,310
In the last year, we created our first variables and we used immutable variables, and we also saw

3
00:00:08,310 --> 00:00:13,140
what an mutable variable is, how immutable variable.

4
00:00:13,530 --> 00:00:16,980
Now, what I'm using here is a comment.

5
00:00:17,130 --> 00:00:18,550
So this here is a comment.

6
00:00:18,840 --> 00:00:22,010
This is code that will not be considered by the compiler.

7
00:00:22,140 --> 00:00:28,120
So it will not have any influence onto our application or our program.

8
00:00:28,410 --> 00:00:32,549
It's just a comment that helps me to understand what my code does.

9
00:00:32,549 --> 00:00:35,880
And it also helps other developers to understand what the code does.

10
00:00:36,150 --> 00:00:42,510
And they are really great to not only understand what code does, but they are also great in order to

11
00:00:42,660 --> 00:00:44,110
know what you need to do.

12
00:00:44,130 --> 00:00:50,490
So, for example, if you add to do, then, you know, OK, at this point I will need to add a functionality,

13
00:00:50,490 --> 00:00:53,730
add new functionality, for example.

14
00:00:54,120 --> 00:01:00,750
And this is great because then you can go to your Tudou window here at the bottom and you can very quickly

15
00:01:01,350 --> 00:01:02,220
find this.

16
00:01:02,220 --> 00:01:04,860
So let's say I go to a different document.

17
00:01:07,830 --> 00:01:09,570
And I go to my.

18
00:01:11,160 --> 00:01:15,870
Main activity and now in my to do, I can simply.

19
00:01:17,310 --> 00:01:27,270
Find my to do aliment and directly goes over to this spot, and this is amazing because it really helps

20
00:01:27,270 --> 00:01:29,650
me to navigate through my files.

21
00:01:29,670 --> 00:01:34,530
In this case, it's super easy because I only have two documents, but once I have many different documents,

22
00:01:34,860 --> 00:01:36,170
this will come in very handy.

23
00:01:36,750 --> 00:01:43,850
Other than comments with just two Slasher's, we can also create multiline comments by by using a slash

24
00:01:43,860 --> 00:01:47,400
and then a asterisk and with.

25
00:01:48,610 --> 00:01:57,450
That automatically creates the closing comment or the ending comment, which is an asterisk with a slash,

26
00:01:57,460 --> 00:02:00,580
so everything in between here will be a comment.

27
00:02:00,760 --> 00:02:04,210
This is a comment.

28
00:02:04,850 --> 00:02:07,600
So this is a multiline comment, to be precise.

29
00:02:07,600 --> 00:02:10,570
Morti line comment.

30
00:02:12,300 --> 00:02:18,090
All right, so just so you know how you can create comments and what they do so they don't have any

31
00:02:18,090 --> 00:02:25,470
impact onto our program on the execution time, on the compiling time, none of that is just for us

32
00:02:25,710 --> 00:02:26,580
as a developer.

33
00:02:27,690 --> 00:02:27,990
All right.

34
00:02:27,990 --> 00:02:30,660
Now let's have a look at other variable types.

35
00:02:30,930 --> 00:02:35,220
I told you that Caitlin is a typed language.

36
00:02:35,580 --> 00:02:40,950
This means that every variable is of a specific type and type.

37
00:02:40,950 --> 00:02:49,410
Inference is a concept that allows us to just assign a value to a variable and Scotland will know of

38
00:02:49,410 --> 00:02:51,120
which type that variable will be.

39
00:02:51,540 --> 00:02:54,530
So, for example, it knows that this is of type string.

40
00:02:55,020 --> 00:03:03,600
If I create another variable, let's say my H and I assign thirty one to it, then this my age variable

41
00:03:03,600 --> 00:03:07,230
will be of type string will be of type int so.

42
00:03:08,530 --> 00:03:18,910
This is an end and this year as a string, all right, agents are used for holding numbers and they

43
00:03:18,910 --> 00:03:22,870
require a certain amount of space in our memory.

44
00:03:24,230 --> 00:03:32,510
For example, in Integer requires 32 bits of memory if we want to use other types, they're available

45
00:03:32,510 --> 00:03:32,910
as well.

46
00:03:33,350 --> 00:03:36,470
So I'm just going to paste in some other types in here.

47
00:03:36,770 --> 00:03:40,220
For example, there is this type called byte.

48
00:03:40,700 --> 00:03:45,410
Then there's this type called short, the type called end and to type called long.

49
00:03:46,070 --> 00:03:55,580
And all of them are integer types and integer types are whole numbers and each of them requires a different

50
00:03:55,580 --> 00:03:56,910
amount of space.

51
00:03:57,350 --> 00:04:05,430
So for example, a bite is just eight bits, requires eight bits in a memory, a short require 16 bits

52
00:04:05,430 --> 00:04:09,890
of memory and 32 bits and long 64 bits.

53
00:04:10,760 --> 00:04:13,530
Now here it says the value is out of range.

54
00:04:13,580 --> 00:04:17,790
So this value is too long for even a long value.

55
00:04:18,200 --> 00:04:23,480
So if you have a very long number, this could be used, for example, for a Social Security number

56
00:04:23,480 --> 00:04:25,100
or for a credit card number.

57
00:04:25,370 --> 00:04:31,430
Then you could use a long and here actually it doesn't fit like this anymore.

58
00:04:31,580 --> 00:04:34,760
So I stood like that.

59
00:04:37,260 --> 00:04:39,120
And then we have a super long number here.

60
00:04:39,840 --> 00:04:44,970
Now, you might wonder why is this bites short and where are all of these coming from?

61
00:04:45,420 --> 00:04:48,000
Well, they come from me answering them.

62
00:04:48,150 --> 00:04:54,300
So here I explicitly say this variable called my bite should be of type bite.

63
00:04:54,570 --> 00:04:55,500
How do I do that?

64
00:04:55,530 --> 00:05:00,290
Well, I can't do that by using the colon and afterwards the type.

65
00:05:01,230 --> 00:05:08,670
But of course, if I use a bite type, I can not use a long number because it will say.

66
00:05:09,670 --> 00:05:16,600
The integer literal does not conform to the expected type, but this means that the value that I entered

67
00:05:16,600 --> 00:05:24,280
here is so long that it's usually an integer, but we are trying to store it in a bit variable.

68
00:05:24,280 --> 00:05:28,390
And that doesn't work because an integer needs a lot more space than a bite.

69
00:05:28,780 --> 00:05:33,950
So we need to make sure that the value that we assign here is correct.

70
00:05:34,480 --> 00:05:36,820
Now, at the same time, we don't need to do that.

71
00:05:37,090 --> 00:05:38,530
You see, I do that here.

72
00:05:38,620 --> 00:05:39,700
I say this is a buy.

73
00:05:39,730 --> 00:05:40,720
This is a short design.

74
00:05:40,740 --> 00:05:41,740
And this is a long.

75
00:05:42,130 --> 00:05:43,230
But we don't need to do that.

76
00:05:43,240 --> 00:05:43,930
You saw it here.

77
00:05:44,230 --> 00:05:46,330
I just assigned a value thirty one.

78
00:05:46,690 --> 00:05:51,060
And that will automatically assigned the right data type.

79
00:05:51,670 --> 00:05:56,920
And usually if you don't explicitly say that you want to have a bite or a short, it will just assign

80
00:05:57,580 --> 00:05:58,330
an editor.

81
00:05:58,750 --> 00:06:01,200
Cotton will just assume that this is an integer.

82
00:06:01,630 --> 00:06:02,460
How do I know that?

83
00:06:02,500 --> 00:06:07,950
Well, you can just enter my age and you can see here on the right hand side that it is an integer,

84
00:06:08,170 --> 00:06:08,620
so.

85
00:06:09,790 --> 00:06:16,720
Scotland did the magic for us, and it automatically assigned to type it, which is called or does approach

86
00:06:16,720 --> 00:06:19,240
here is called type inference.

87
00:06:20,000 --> 00:06:24,670
So it just inferred to type based on whatever value we assign to it.

88
00:06:25,240 --> 00:06:28,590
Of course, if we do so, then we have to assign a value to it.

89
00:06:29,200 --> 00:06:33,300
So I cannot just create via my H without assigning a value to it.

90
00:06:33,310 --> 00:06:35,500
I need to assign a value to it.

91
00:06:37,590 --> 00:06:42,840
There are a bunch of other types as well, so these are the integer types that we looked at.

92
00:06:43,170 --> 00:06:46,570
Now let's look at the floating point number types.

93
00:06:46,710 --> 00:06:50,640
So there are types which are required for floating point numbers.

94
00:06:50,880 --> 00:06:55,860
For example, the floating point number types float, which is a 32 bit.

95
00:06:57,200 --> 00:07:00,230
Data type and double, which is a 64 bit data type.

96
00:07:00,710 --> 00:07:06,680
Now here I'm assigning one three or thirteen point thirty seven to my float variable, which I called

97
00:07:06,680 --> 00:07:08,990
my float, but it's still complaining.

98
00:07:09,200 --> 00:07:10,340
So what's wrong here?

99
00:07:10,670 --> 00:07:17,960
Well, if I assign a floating point value, it usually assumes that I want to assign a double, as you

100
00:07:17,960 --> 00:07:18,620
can see here.

101
00:07:19,430 --> 00:07:27,680
But if I explicitly only want to use a float, which has a lower range, so which just can't be as long

102
00:07:27,680 --> 00:07:33,740
as that of a number, then I have to explicitly state that by adding an F at the end this F stands for

103
00:07:33,740 --> 00:07:34,180
float.

104
00:07:34,400 --> 00:07:39,120
So I'm just saying, OK, this variable should be of type float or this value that I'm assigning here.

105
00:07:39,500 --> 00:07:47,180
So if I should get rid of this, for example, and I now check my float, you will see that it is a

106
00:07:47,180 --> 00:07:47,580
float.

107
00:07:48,350 --> 00:07:48,860
All right.

108
00:07:48,870 --> 00:07:54,170
So if I get rid of this F and I check what my float is, you can see now it's a double.

109
00:07:54,680 --> 00:08:01,790
And that has to do with me assigning this F to it and explicitly stating that it should be a float.

110
00:08:03,670 --> 00:08:10,420
So if you really need to save space, you can use floats if the numbers are not going to be huge, but

111
00:08:10,420 --> 00:08:16,990
if you need flexibility, long numbers or you just don't care about space, then you can use doubles.

112
00:08:17,230 --> 00:08:23,020
And generally speaking, doubles are preferred by Cottan, or they will be most of the time use if you

113
00:08:23,020 --> 00:08:25,510
don't explicitly state that it's going to be a float.

114
00:08:26,950 --> 00:08:32,590
Using floats is important, for example, when you develop video games and you want to calculate the

115
00:08:32,590 --> 00:08:39,700
physics, then having as fast as possible calculations will be more important than having super duper

116
00:08:39,700 --> 00:08:40,289
precision.

117
00:08:40,630 --> 00:08:42,559
So that's where float comes into play.

118
00:08:42,970 --> 00:08:45,790
But most of the time, stubbled will be your way to go.

119
00:08:46,210 --> 00:08:46,600
All right.

120
00:08:46,600 --> 00:08:49,660
So these are the no types, but there are other types as well.

