Welcome back.
In this video, I would like to implement some more of the button functionality, for example, once
we click a decimal point.
I want this to be displayed correctly because the problem is I cannot use a decimal point multiple times.
Right.
At least in a calculator that you shouldn't be able to do that.
So what we want to do is to display a decimal point, but only one at a time because only one decimal
point will be possible at once in order to do so.
What we will need to do is we will need to add a bunch of helper variables for to help a verbals, to
be precise.
And I'm going to create one that I'm going to call last numeric.
So this one will contain the information if it's.
Containing a numeric value or the last button that was pressed or if it doesn't.
All right.
So last limerick.
And I'm just going to say that it's a boolean, even though it's not necessary, but it's going to be
a little clearer what's happening here.
And then last DOT, which also will be a boolean, which I'm going to set to false.
But as I said, this would not be necessary boolean keyword.
Right.
Because as I'm using false here, it will know that last dot should be a boolean.
All right.
Next, what I want to do is I want to implement this little function on decimal point is how I'm going
to call it so fun on decimal point.
And as it should be run, once we press the button, we need to have a view as its parameter and then
we want to check if the last button was numeric.
And not.
Last thought, which means that we only want to run something if the value before was actually a number
and was not a dot before that.
All right.
And then I'm going to use TV input that I penned and here I'm going to add a dot.
So what's important now is that once we do that, we set less numeric to false because now we had a
decimal point that we used as the last button that we pressed.
And at the same time, last dot is said to true because now we actually have pressed the dot or have
created a decimal point there.
So we need to set this variable to true.
Now, of course, we need to implement this because as you can see, this is a yellowish color.
This is a great color.
This means that this functionality or dysfunction here is never used and that means we need to implement
it somewhere.
And that would be this point here.
This dot.
So instead of on digit, we will use one decimal point.
All right, so now let's run this again.
There we are.
Let's try to press the dot, as you can see, nothing happens.
Now let's press five and the dot.
And nothing happens as well.
Why is that?
That is because.
We also, of course, need to set less numeric to true once we press on the digits.
So here last name, Eric, is going to be Drew.
So we are setting the flag of Latin America, true, and that's this bullying that we had here, which
just stores the information.
If we pressed a digit or another button, for example, the decimal point.
All right.
Running it again.
Let's test it again.
So the dot didn't work.
Let's press the 5:00 and then the dot.
Now it works.
Now let's president again.
As you can see, it doesn't work.
So it only works once and now, of course, when we clear, you can see now it's still not working.
That's because we never said that.
Once we clear that, we reset everything.
So what we need to do is unclear.
We need to set everything back.
So what I'm going to do here is I'm just going to say last numeric is going to be false.
And last thought is also going to be false, because that was the initial state that we had here at
the beginning.
And we also need to have the same state once we press on clear.
So now if you run this again.
We will see that say we undervalue here we can a president again, let's clear no precedent.
And as you can see, it works totally fine here at the beginning.
It doesn't work.
Only after I have entered a value, I can add the decimal point.
All right, so that's it for now.
I'd say we check on operator, so once we press one of those in the next video.
So see you there.