One of the greatest features that was released in Essex and actually one of my favorites is tablet strength.
It allows us to work with strength in a different way.
As you already know, in iOS five, we use single and double quotes and also in order to concatenate
values, we had to use.
Plus operator, let's recall once again how to deal with strings and gong to create variables.
And let's use your known constant loud declarations.
Creates variable name John.
Then age, which equals to 28.
Then create a third variable profession.
Where the value instructor.
Then create a function which actually will be a simple one, because I just want to remind you how to
work with -- and how to concatenate values.
At first I'm going to use S5 code.
Therefore, let's call this function person.
Yes.
Then run in council.
Some text, right, my name is.
Then plus name.
Plus, again, some text I am.
That plays the variable age.
That plus years old and I am.
And finally, insert here.
Variable profession, so here we use string values which are concatenated to variables, name, age
and profession.
For that we have used several plus size.
Also, each part of string value is surrounded by quotes, but it's the way how we can work with string
values in year five.
OK, let's call this function right.
Person E is five.
So we have in council.
My name is John, I'm 28 years old and I'm instructor, so we got the results, what we needed, but
agreed that we have achieved it kind of hard way because, as we said, we have used several plus science
quotes and so on in order to avoid such inconvenient way of working.
Yes, this allows us to use tablet strength.
Let's see what I'm talking about.
Let's copy this function and paste here.
Also, change the name from.
Yes, five to six.
I'm going to delete this content, which is placed in the log, and now it's time to use new temporary
strengths which are expressed by tactics in most cases.
This key is placed on the left side next to one key on keyboard.
So the first that we want to write here is my name is.
Then we need to place your name variable, but for that we do not need use plus size or adding single
quotes anymore.
Instead of that, we have to write dollar sign.
That open cut the prices in place now variable then simply we have to make space here and right the
next coming tax, which is an.
As I see, we have to place here another variable, so let's do it and the same way use dollar sign,
then curly braces and then age.
Then again, right, text years old and I am and finally place here the variable profession in the same
way with dollar sign and color prices.
So as you see, we didn't use your plus sign.
Also quotes, the entire thing is surrounded by batiks and the variables are placed in color prices
and they are written with dollar signs.
All right, let's invoke this function.
Then reload and you see that we got an exact same result, but again, in more convenient and nice way.
OK, you see here that we have words.
I am.
And suppose that we want to write it with apostrophe for that in is five.
We had to use little Huck.
We just need to use backslash and that single quote.
Reload and see that it works, but in Essex, we can do it in much more simple way.
We don't need any slashes because the string is surrounded by tactics which are absolutely different
characters from codes.
We just need to place your single quotes.
Reload and we got the same result.
All right.
If we want to make line break in year five, we could do that using backslash and an.
So reload and you see that line is broken in two parts.
As for ethics, we can just break the line in code editor using pressing the enter key, which again
is more convenient way to break lights.
OK, so as I see tablet strength, a really great feature of ethics, it makes our lives much easier
as a programmer, actually, I would like to note that if you don't need to concatenate string values
with variables, then you can use a standard SFI way.
I mean, you can declare variables with single or double quotes.
So it's not mandatory to use tactics with variable declarations.
All right.
Let's use some more examples.
I'm going to create a function which will actually calculate years of experience of person.
Suppose that the person has working experience in two companies and we want to get the total sum of
years of experience from both companies, so let's insert here two parameters, company one and.
Company to.
Then inside Kolob racist White Castle log.
So in order to get the some of years of experience, we need to add the years of experience from company
to company to and concatenate this value to string values.
So.
Right.
I have.
Then plus and open parenthesis.
Insert here parameters company one and company to.
Then plus.
Years of experience.
In programming.
Let's invoke dysfunction and also use some arguments, right, for example, four and seven reload.
And of course, it works.
We got the results.
I have 11 years of experience in programming.
All right, let's transform it into ESX version instead of Cote's place here.
Tactics.
Then delete those plus signs.
Surround Company one and company two with Calabrese and.
Also place here, dollar sign.
That's without.
And you can see that we have, again, the same result as he saw at first, the addition was performed
in coal prices and then we got string value, OK?
Besides that, we were able to invoke the function inside collaborationists.
Let's use here the value from person is six function for that.
Let's change this cost of the log into return statement in order to get the value.
Then place here.
Experienced function, dollar sign and inside Calabrese invoke function.
Person is six.
Reload and we have results.
My name is John, I'm 28 years old and I'm instructor.
I have 11 years of experience in programming.
OK, fine.
It's really cool, right?
So, again, templated strengths allow us to avoid using single quotes or double quotes and the relationship
between them, which sometimes becomes really annoying.
Also, we do not need to use classes anymore.
All right.
Before we finish this lecture, I'm going to introduce to you several built in three methods which were
released in ethics.
Those methods, in some cases may be used as powerful and great tools.
The first method that I want to show you is start with method.
So create a variable and call it grid, then assign to it string value.
Hello, my dear students.
Let's say we want to check if this thing value starts with specified character or characters, so for
that we can use starts with matter, which actually returns boolean value, true or false.
So.
Right, Castlewood log.
Grit that starts with.
This matter takes as an argument, character or characters, which we want to check, as you see, our
three value starts with hello.
So let's use this word here.
Right.
Hello.
Reload and we got through it.
All right, hello without capital letter.
Then we will get false because this matter takes into account the sensitivity.
All right, in order to check if string value ends with specified character, we can use and with method
that's duplicated, changed the name of the method.
Right, and with.
That revolt and we have false because this thing doesn't end with hello, let's change it into, for
example, E.A., then you see that we've got through.
All right.
The next method that I want to show you is includes which actually checks if the string value includes
the specified string characters that duplicate it again and change the method.
Right.
Includes.
And as an argument, let's place here, dear, rule the page and you see that we have true because the
work for you is a part of our strength value.
OK, and the last method that I'm going to introduce you is repeat, as the name of this method tells
us, it's obvious that it repeats the string values.
So, for example, if we pass as an argument three, then we will get our string value three times.
All right.
Those methods are very helpful in the real world coding.
So, you know already how they work and I'm sure that you will use them in your future projects.
OK, it was all about strength in ethics.
Let's go ahead.