1
00:00:01,940 --> 00:00:08,400
Will come back again in this list then we actually have an exercise exercise is this I'm going to set

2
00:00:08,400 --> 00:00:09,420
the stage for you.

3
00:00:09,420 --> 00:00:15,270
So you have two pieces of strings and I want you to find a way to attach them to each other I'm putting

4
00:00:15,360 --> 00:00:16,530
them together.

5
00:00:16,800 --> 00:00:22,860
That's essentially called apprehending or concatenating two pieces of things to each other.

6
00:00:22,860 --> 00:00:26,230
So let me go to exclude him.

7
00:00:26,460 --> 00:00:37,190
I'm going to start a new project say new project and this new project come on by and or is called the

8
00:00:37,560 --> 00:00:41,720
strings and in my hand the strings.

9
00:00:41,770 --> 00:00:48,600
And this is the staging part of the I'm going to do for you is going to be like this is going to be

10
00:00:50,980 --> 00:01:04,860
one of those is going to be a string string one that says hello and it's going to be a string ring true

11
00:01:05,010 --> 00:01:08,310
that says War.

12
00:01:09,120 --> 00:01:15,090
So then once you do is this I want you to find a way that when you print this if you print the two of

13
00:01:15,090 --> 00:01:20,470
them together so it says something like Hello world.

14
00:01:20,670 --> 00:01:23,020
I put the little space between them.

15
00:01:23,160 --> 00:01:26,310
So good luck and post the video here.

16
00:01:26,310 --> 00:01:27,350
Try it on your own.

17
00:01:27,390 --> 00:01:31,740
And then I'm going to go through that and I'm going to do it in multiple different ways.

18
00:01:31,740 --> 00:01:37,330
So we get a sense of so many different you know things in OK.

19
00:01:37,480 --> 00:01:40,460
I hope you succeeded and here's how I'm going to do it.

20
00:01:40,670 --> 00:01:42,770
I'm going to do it in several different ways.

21
00:01:42,770 --> 00:01:49,130
One of them would be the simplest one with Beatty's and Aslaug and then a slowdown would say there is

22
00:01:49,220 --> 00:01:52,460
one object there is on space between them.

23
00:01:52,490 --> 00:01:59,300
And then there is another object and then I'm going to say the string one on the string too.

24
00:01:59,630 --> 00:02:07,190
So essentially says preens what ever you'll find in this one with a little less space between them and

25
00:02:07,190 --> 00:02:12,480
then whatever you find in the other one that's printed out and see if it works.

26
00:02:19,000 --> 00:02:26,070
And now we have done hello or two separate ones.

27
00:02:26,140 --> 00:02:28,050
There's a space between them.

28
00:02:28,100 --> 00:02:32,490
This isn't however as funky as the next one.

29
00:02:32,530 --> 00:02:34,800
The next one is going to be like this.

30
00:02:34,960 --> 00:02:39,910
I'm going to say this thing let's call this one result of a string.

31
00:02:39,910 --> 00:02:47,170
This is the resist thing which is going to be a string string.

32
00:02:47,460 --> 00:02:53,870
Format in this thing with format I'm going to say essentially the same thing.

33
00:02:54,130 --> 00:03:04,540
I have one piece in space and I have another piece and the two pieces are a string one on the string

34
00:03:04,660 --> 00:03:05,220
two.

35
00:03:05,470 --> 00:03:10,010
So now I have a new string which is called resolve the string.

36
00:03:10,030 --> 00:03:13,210
The result the string is the result of being.

37
00:03:13,240 --> 00:03:16,990
This one is space and the next one.

38
00:03:17,050 --> 00:03:19,310
And of course I can now print that one.

39
00:03:19,390 --> 00:03:26,380
So I'm going to say and Aslaug what ever you'll find in resolve the string.

40
00:03:27,490 --> 00:03:29,150
So bring this here.

41
00:03:29,560 --> 00:03:33,980
Let's say this is first my third.

42
00:03:34,180 --> 00:03:37,220
This one is second method.

43
00:03:37,490 --> 00:03:38,930
Thank you.

44
00:03:39,590 --> 00:03:41,090
So let's do that.

45
00:03:43,190 --> 00:03:44,500
So we be expected.

46
00:03:44,530 --> 00:03:47,170
The boss are of printing the same thing.

47
00:03:47,230 --> 00:03:56,200
I could actually play a little cheating here and say first method is that and then say second method

48
00:03:56,860 --> 00:04:01,610
is out of place in the wrong place.

49
00:04:01,630 --> 00:04:04,280
After all the quotation marks of course.

50
00:04:04,510 --> 00:04:11,740
And now if you play or if you run the harp It says first method says your second mother says hello world.

51
00:04:11,890 --> 00:04:18,220
Now let's see another way of doing the exact same thing on this one I'm going to call her method and

52
00:04:18,410 --> 00:04:20,330
my method here's what I'm going to do.

53
00:04:20,340 --> 00:04:25,070
I'm going to say this thing or let's call it here.

54
00:04:25,280 --> 00:04:32,130
RAZ This ring her resolve this thing gets going to be my dream girl.

55
00:04:32,140 --> 00:04:42,180
One myth is read by appending a string and what do what happens with what happens with a string.

56
00:04:42,510 --> 00:04:45,980
So at the second string to the first string.

57
00:04:46,090 --> 00:04:54,250
Once again there is a string which is the result of appending the string to string one.

58
00:04:54,350 --> 00:04:58,930
And I should add a semicolon in my den in here let's print this one.

59
00:04:59,110 --> 00:05:07,590
Let's see if this one actually works on their method is Taro's resolve the string.

60
00:05:07,660 --> 00:05:10,730
What do you think is going to happen when I hit the wrong button.

61
00:05:11,110 --> 00:05:12,160
Let's see together.

62
00:05:12,470 --> 00:05:13,800
Yes Ron.

63
00:05:14,310 --> 00:05:19,590
And it does print but it doesn't have the little space to expected it.

64
00:05:19,840 --> 00:05:21,500
So here's what we could do.

65
00:05:21,550 --> 00:05:30,580
I could say first get the string one and append this through in a space.

66
00:05:30,580 --> 00:05:40,670
So by now here the result the string should be saying hello and a space then I'm going to say hello

67
00:05:40,760 --> 00:05:44,240
resolve the string is a tear.

68
00:05:44,260 --> 00:05:51,370
Resolve to string the string by appending the string to.

69
00:05:51,670 --> 00:05:54,100
So they get added to each other.

70
00:05:54,110 --> 00:05:57,070
Now this is a very important concept.

71
00:05:57,070 --> 00:06:05,140
Let's see the result and then I will explain it in a second so it prints it properly the way we want

72
00:06:05,140 --> 00:06:05,600
it.

73
00:06:05,680 --> 00:06:08,110
And now let me talk about that thing that I said.

74
00:06:08,140 --> 00:06:10,180
It's very important here.

75
00:06:10,330 --> 00:06:11,020
Result.

76
00:06:11,020 --> 00:06:12,670
The string is here.

77
00:06:12,680 --> 00:06:22,780
The result the string which is something that's easier and a simpler example of it in my hand is three.

78
00:06:22,960 --> 00:06:29,240
And then I'm going to say my hand is my in plus five.

79
00:06:29,450 --> 00:06:30,580
What does that mean.

80
00:06:31,610 --> 00:06:36,150
Is it if you show this through your high school teacher they would freak out because they would tell

81
00:06:36,150 --> 00:06:36,450
you.

82
00:06:36,450 --> 00:06:42,500
How can one side of an equation be the same thing plus something else.

83
00:06:42,690 --> 00:06:45,240
But that's the thing in programming.

84
00:06:45,270 --> 00:06:48,140
This isn't really a sign of equality.

85
00:06:48,150 --> 00:06:55,730
Rather it is a sign of assignments not the quality but the assignments.

86
00:06:55,740 --> 00:07:00,580
It means take whatever is on the right side of the assignments.

87
00:07:00,780 --> 00:07:02,130
Do the math on it.

88
00:07:02,190 --> 00:07:05,920
Do whatever you want to do to it and then assign it to the left side.

89
00:07:06,090 --> 00:07:09,420
So in this case it will be three plus five.

90
00:07:09,450 --> 00:07:18,180
That is AIDS and 8 cause might it becomes a mistake here there isn't this thing becomes what ever is

91
00:07:18,180 --> 00:07:18,760
in here.

92
00:07:18,820 --> 00:07:26,780
Resolve the string of pens to eat something else and then put it back in the territories or this string.

93
00:07:26,790 --> 00:07:31,600
Now if you're wondering what is the practical example of such a thing.

94
00:07:31,740 --> 00:07:33,470
Let me give you an example.

95
00:07:33,480 --> 00:07:36,980
Remember we had an integer play.

96
00:07:37,200 --> 00:07:46,470
Our turn of play or play or something like the effect that was essentially how many times player had

97
00:07:46,470 --> 00:07:55,320
played a round of play round of play let's say round of play is 0 and then player plays once then we

98
00:07:55,320 --> 00:07:59,810
say around of play these round of play plus 1.

99
00:07:59,970 --> 00:08:01,510
So it gets added to it.

100
00:08:01,680 --> 00:08:03,700
Let's say now the player has played.

101
00:08:03,730 --> 00:08:04,110
I don't know.

102
00:08:04,110 --> 00:08:10,680
Sixty five times and then it says round of play is 65 plus 1.

103
00:08:10,690 --> 00:08:12,890
So round of play becomes 66.

104
00:08:13,020 --> 00:08:18,810
So it keeps counting up walks towards whatever it is that you're trying to do.

105
00:08:18,810 --> 00:08:21,160
So this is a very common practice.

106
00:08:21,300 --> 00:08:26,010
Another common practice that's just of the building blocks of doing programming.

107
00:08:26,230 --> 00:08:28,440
It is essentially called assignment.

108
00:08:28,470 --> 00:08:32,470
Everywhere that you see an equal sign it's a sign of assignment.

109
00:08:32,490 --> 00:08:36,220
It doesn't mean that the side is equal to that side.

110
00:08:36,240 --> 00:08:43,590
It means the left side should become what is on the right side the left side should become what is on

111
00:08:43,590 --> 00:08:45,590
the right side of the equation.

112
00:08:45,900 --> 00:08:49,030
So that's about that.

113
00:08:49,710 --> 00:08:54,720
Before I finished this lesson I want to introduce you to an new concept as well.

114
00:08:54,720 --> 00:08:58,320
And that's the concept of mutable values.

115
00:08:58,490 --> 00:09:00,980
You see so far we had a string.

116
00:09:01,020 --> 00:09:06,150
But now I want to show you something called an as mutable string.

117
00:09:06,600 --> 00:09:13,610
And the difference between an and assisting an end is mutable a thing is that anything that is mutable.

118
00:09:13,620 --> 00:09:22,780
It means it can be modified so you can essentially say mutable means means more before any of that.

119
00:09:22,980 --> 00:09:30,600
So I know that we could actually take a string and put a value in it and then assign something else

120
00:09:30,600 --> 00:09:31,050
to it.

121
00:09:31,050 --> 00:09:37,490
For instance up here we could say a string one is low and then again we could say this thing 1 is not

122
00:09:37,530 --> 00:09:38,290
hello.

123
00:09:38,650 --> 00:09:44,550
What we couldn't do is go with this a specific characters and change them.

124
00:09:44,570 --> 00:09:48,470
You couldn't say whatever is the value in this thing.

125
00:09:48,480 --> 00:09:52,820
Go and find the one that says and modify that.

126
00:09:53,070 --> 00:09:57,360
And that is what we can do with immutable strings with mutable things.

127
00:09:57,360 --> 00:10:01,340
We can modify whatever is currently in them.

128
00:10:01,380 --> 00:10:03,240
So let's go ahead and make a new one.

129
00:10:03,300 --> 00:10:07,600
And it's interesting my mutable string.

130
00:10:07,670 --> 00:10:17,400
I'm going to give it a value such as my name for instance keep in mind that this is a wrong way of defining

131
00:10:17,470 --> 00:10:24,030
immutable strings because mutable things can not by default become strings and that's why it's giving

132
00:10:24,030 --> 00:10:25,360
me a warning.

133
00:10:25,440 --> 00:10:35,340
The correct way of doing this is this instead of that I'm going to have to write in as mutable a string

134
00:10:36,760 --> 00:10:39,510
as to with a string.

135
00:10:39,510 --> 00:10:45,750
So it's thought with a string based on a string of characters and what are those characters.

136
00:10:45,900 --> 00:10:48,480
It's essentially going to be mining.

137
00:10:48,520 --> 00:10:54,180
Or if you want in our case it could be a strange one.

138
00:10:54,600 --> 00:10:59,180
So I'm making immutable a string based on a string one.

139
00:10:59,550 --> 00:11:05,010
And then I could do things such as this I would say my immutable string.

140
00:11:05,010 --> 00:11:06,780
Append a string.

141
00:11:06,780 --> 00:11:07,850
What do I want out then.

142
00:11:07,860 --> 00:11:09,680
I want to append the space.

143
00:11:10,080 --> 00:11:14,490
And then I would say my mutable string.

144
00:11:14,490 --> 00:11:15,880
Append a string.

145
00:11:15,990 --> 00:11:20,160
Then what happened to it when I opened the string two treats.

146
00:11:20,280 --> 00:11:28,060
So this is essentially modifying the existing one on like the last time that we actually had to assign

147
00:11:28,110 --> 00:11:35,390
the value entirely saying whatever is in your add to that little bit too.

148
00:11:35,550 --> 00:11:42,950
And that's essentially a concept of mutability in Objective-C see a lot more of this when we talk about

149
00:11:42,950 --> 00:11:49,170
the collections specifically when we talk about N.S. arrays and as mutable arrays but they just want

150
00:11:49,170 --> 00:11:53,540
you to get a sense of what it means for something to be mutable.

151
00:11:53,640 --> 00:12:00,540
Don't be don't be puzzled by the term if the term is difficult for you just consider it as modifiable.

152
00:12:00,540 --> 00:12:09,090
So if something is mutable it means it can be modified its contents can be modified as you can imagine

153
00:12:09,150 --> 00:12:22,090
if I call this one my fourth method fight going on I say and it's like for all your self-worth.

154
00:12:22,090 --> 00:12:24,180
I hope so.

155
00:12:25,000 --> 00:12:26,500
My immutable string.

156
00:12:26,500 --> 00:12:27,700
Let's run it.

157
00:12:29,880 --> 00:12:34,730
And down in meannesses forth metod also has become Hello world.

158
00:12:34,920 --> 00:12:36,510
So that's about that.

159
00:12:36,510 --> 00:12:42,780
Let me zoom into it in a way that if you want to spend some time on it I can pause the video here for

160
00:12:42,780 --> 00:12:47,070
a few seconds and you can pause based on that once you're good with this.

161
00:12:47,070 --> 00:12:48,800
Let's move on to our next list.

162
00:12:48,810 --> 00:12:56,920
And there we use some of these learnings into using it using an actual iOS application.

163
00:12:56,970 --> 00:12:58,340
So I'll see you there.
