Hello, friends, who won our last lesson, we talked about data types in typescript, so now I want
to carry on with that concept in this particular lesson.
So we talked about the enum keyword last.
So we'll start with the void type in this lesson.
As you already know, we use the void type in functions that do not return any value, so it simply
define a function.
And a console print, hello.
And if you wish, you can return a different value.
However, if we come in here and define the function as void, then returning will give us an error
because we specify that we will not return any value by making the function void.
So if we don't want to return any value and we want to do an operation there, we can use the void type
to print something like here.
All right, now let's get into, well, briefly, the undefined type, actually, what this data type
means.
So we've defined a number variable, but.
If we've not assigned any value to this variable, this variable will be undefined.
But if we come in here and assign a value here, then undefined will disappear.
You know, the data types similar to undefined is the null type, and we usually encounter these and
database errors.
So I should say that we've defined a class, but.
We haven't shown any references like this, and when we want to access this class, the result will,
of course be no.
Because we do not provide any reference.
So that's that's that for data times, but before we finish the lesson here, I want to talk a little
bit about data assertions.
To evaluate the situation, I'll first create a variable and define a string expression.
So look here, we can see that our variable now is a string.
Now, if we write our variable and put a dot.
We can see the string methods that we can use.
Thus, we can do different operations on this variable, for example, when we well, we can capitalize
all the letters here or.
We can use the length of this string expression.
And here I'm assigning the character length of the string expression to a different variable like this.
So there's no problem with the transactions that we've done so far.
So what will happen if I change the variable that I first define?
Well, this variable is no longer a string.
It's an any variable.
When we put a dot here again and look at it.
We can't use a previous method because those methods are valid for string variables, so in order to
fix this, I write the type I want to convert between the lesson and read it in signs.
And I put this expression in parenthesis.
And as you can now see, when I put a dot, I can see the method.
So in this way, we have converted a variable that is any to a string variable.
So here, you definitely need to pay attention to the variable that we want to transform and the variable
here must be the same.
Oh, get an error if I come in here and right, no, right, because this is a stirring expression.
So we can write this expression differently as follows.
So define another variable and I'll write the name of the first variable.
Then right as string inferences.
And as you can see, we can now recognize that they are string method's.
So we can make the type conversion into different forms of writing.
And that said, I think we're done now, so in our next lesson, we're going to start functions.
All right.
See you then.