1
00:00:00,210 --> 00:00:00,810
Welcome back.

2
00:00:00,840 --> 00:00:04,830
In this video, we're going to look at other data types, such as booleans.

3
00:00:05,460 --> 00:00:06,570
So for example.

4
00:00:08,070 --> 00:00:14,500
Bullion is a type which represents logical values, so it can have two possible values, true and false.

5
00:00:14,730 --> 00:00:20,340
So we have this variable called is Sunny and I'm going to make it to bullion and now I'm going to sign

6
00:00:20,340 --> 00:00:23,240
true to it, let's say a little later.

7
00:00:23,250 --> 00:00:24,770
The sun is not shining anymore.

8
00:00:25,080 --> 00:00:29,010
Then I can just say it's sunny is going to be false.

9
00:00:29,160 --> 00:00:31,680
So I reassigned a new value to it.

10
00:00:32,070 --> 00:00:34,370
So I assign faults to it now.

11
00:00:34,380 --> 00:00:38,250
So Sunny or is Sunny will now be false?

12
00:00:39,420 --> 00:00:45,000
Of course, I don't need to assign the Boolean to it or I do need to explicitly state that I want to

13
00:00:45,000 --> 00:00:50,910
use it as a boolean, because once I assign a boolean value such as true to it, it will know that his

14
00:00:50,910 --> 00:00:52,630
son is going to be a boolean type.

15
00:00:53,220 --> 00:01:02,700
Then there is another type which is called character or char, so you can assign a char by using the

16
00:01:02,700 --> 00:01:12,930
postoffice so you can see the value letter char is just an A and I make this a char by assigning a value

17
00:01:13,050 --> 00:01:17,440
or a letter in this case which is surrounded by apostrophes.

18
00:01:18,150 --> 00:01:24,130
So if we look at letter char, we can see it's of type char which is character.

19
00:01:25,070 --> 00:01:27,990
Did it, did the cha is also of type char.

20
00:01:28,390 --> 00:01:30,290
It's really not that much of a difference.

21
00:01:30,300 --> 00:01:37,350
It doesn't matter if it's an a, a one or even a dollar sign, but as you can see, it cannot contain

22
00:01:37,350 --> 00:01:38,520
more than one sign.

23
00:01:39,120 --> 00:01:41,010
That's the limitation of char.

24
00:01:41,430 --> 00:01:46,050
So a string is basically a connection of multiple chars.

25
00:01:46,290 --> 00:01:48,270
It's just multiple chars together.

26
00:01:48,270 --> 00:01:53,150
In this case, it's five chars which come together to becoming a string.

27
00:01:53,550 --> 00:01:57,040
Now that we talk about strings, let's have a look at strings a little more.

28
00:01:57,540 --> 00:02:04,920
So let's assume we have this string variable, which is called my string or my star, and it has the

29
00:02:04,920 --> 00:02:05,820
text Hello World.

30
00:02:06,450 --> 00:02:13,620
Now, if I want to access a certain character from that string, what I can do is I can use the following

31
00:02:13,620 --> 00:02:14,430
approach.

32
00:02:14,580 --> 00:02:22,290
So I'm going to call this one first char in string and this will be my string.

33
00:02:22,830 --> 00:02:26,450
That's the position zero y zero.

34
00:02:26,790 --> 00:02:32,170
Well, because Cutline is a language which starts calculating or counting at zero.

35
00:02:32,460 --> 00:02:38,430
There are other programming languages which start counting at one such as R, but most programming languages

36
00:02:38,430 --> 00:02:40,500
start counting at zero.

37
00:02:40,500 --> 00:02:42,870
So zero is the first letter.

38
00:02:43,230 --> 00:02:50,540
So if we print this now, let's say we want to print this first char in string.

39
00:02:51,210 --> 00:02:56,130
So let's just do that first character.

40
00:02:57,400 --> 00:02:58,850
And we run this code.

41
00:02:59,050 --> 00:03:00,100
So let me.

42
00:03:01,290 --> 00:03:06,700
Run it again and we see first char or first character is H.

43
00:03:07,530 --> 00:03:10,980
All right, so in the world, the first character was, in fact, H.

44
00:03:11,580 --> 00:03:15,460
If you want to get the last character, what you can do is the following.

45
00:03:16,380 --> 00:03:18,570
So I'm just going to paste it in here.

46
00:03:19,140 --> 00:03:26,670
Last character and string will be again my string and then in square brackets I use my string that length.

47
00:03:26,940 --> 00:03:33,270
With this I get the length of the whole string and then I say minus one, which says, OK, give me

48
00:03:33,270 --> 00:03:38,320
the last one, because if the length is in this case, 11.

49
00:03:38,460 --> 00:03:45,800
So five characters here then one, which is this empty space and then another five characters become

50
00:03:46,320 --> 00:03:47,780
two, 11 characters.

51
00:03:47,940 --> 00:03:51,110
So 11 minus one is going to be 10.

52
00:03:51,390 --> 00:03:56,160
So we're going to get the 11th position, which is going to be the D.

53
00:03:56,700 --> 00:04:00,120
So now let's just print out the last character.

54
00:04:01,400 --> 00:04:07,100
And we can see this last character is deep, which is, in fact, hello world with the.

55
00:04:07,880 --> 00:04:08,500
All right.

56
00:04:08,510 --> 00:04:14,780
So summing it up, there are multiple different types that we can use when we create variables.

57
00:04:15,170 --> 00:04:16,760
Variables are immutable.

58
00:04:16,760 --> 00:04:25,190
If we use the key word and they are immutable, so changeable if we use the VA keyboard, then we don't

59
00:04:25,190 --> 00:04:31,820
have to specifically state what kind of data type we want to use if we assign the right value to it.

60
00:04:32,540 --> 00:04:38,720
If we assign a value, which is of a specific type, such as a number, which is a whole number, it

61
00:04:38,720 --> 00:04:41,380
will automatically assume that we want to have an integer.

62
00:04:41,570 --> 00:04:48,050
So if we want to have a bite or short, for example, then we need to explicitly state that by.

63
00:04:49,290 --> 00:04:56,580
Creating the variable with that type and with long numbers, we can use an underscore in order to make

64
00:04:56,580 --> 00:04:57,480
it more readable.

65
00:04:57,990 --> 00:05:00,510
This is a new feature that is super useful.

66
00:05:00,520 --> 00:05:03,320
We can use that for string for integers as well.

67
00:05:03,330 --> 00:05:05,910
By the way, this makes them more readable.

68
00:05:06,900 --> 00:05:12,690
And the same concept goes for doubles as well, where it assumes that we want to assign a double if

69
00:05:12,690 --> 00:05:14,490
it's a floating point number.

70
00:05:14,730 --> 00:05:21,600
But if we want to specifically use a float, then we have to state that by adding an F to the number

71
00:05:21,600 --> 00:05:22,110
itself.

72
00:05:23,110 --> 00:05:29,830
Then there is the tie bullion, which is used to only have two states, so either something is true

73
00:05:29,830 --> 00:05:34,090
or something is false, which is a super useful and we will use that quite a bit.

74
00:05:34,660 --> 00:05:40,180
And we have characters which we can use in order to just one use one character, which doesn't have

75
00:05:40,180 --> 00:05:45,300
to be a character, but it can also be a number or a symbol.

76
00:05:45,850 --> 00:05:52,090
Then we have String's, which is a collection of a bunch of characters which we can use for text.

77
00:05:52,990 --> 00:05:58,330
And if we want to print something out, we can use this print statement, which then prints it onto

78
00:05:58,330 --> 00:06:06,010
our console, which is this little area here at the bottom, which helps us to test stuff and test if

79
00:06:06,010 --> 00:06:08,560
a certain variable has a certain value.

80
00:06:08,980 --> 00:06:13,150
Of course, there are other ways to do so, but the print statement is a very convenient one.

81
00:06:14,830 --> 00:06:20,170
And another one important aspect, and I told you multiple times, but I really want to state that again,

82
00:06:20,680 --> 00:06:28,270
you don't have to specifically state your data type because of type inference.

83
00:06:29,020 --> 00:06:35,680
And maybe I'm going to add this word here type interference, which just means that.

84
00:06:37,050 --> 00:06:43,890
Finds out the type from context, which is super powerful and useful and makes our life a lot easier

85
00:06:43,890 --> 00:06:44,910
in most cases.

86
00:06:45,660 --> 00:06:47,610
So let's say see you in the next one.

