So now let me actually comment out these lines of code here and then I'm gonna actually paste some more
lines of code here.
So first of all let's actually comment out these lines of code just create a multiline comment here
as you can see here.
Right.
And now I'm going to paste in some lines of code here and then I'm going to explain to you what's going
on here.
So as you can see here these are two lines of code that I pasted here.
So as you can see we have actually another statement here.
So if it's value.
So here I am referring to our integer value.
But as you can see here we actually created this integer variable in line number 28 it value.
And as you can see here we are actually getting the value of this textfield.
As you can see here the value of these takes with value.
Is it the number that takes the plus string right.
So here I am actually getting the value of this EDT number and here I am actually converting this value
to a string value.
And here I am assigning that value that string value is valuable which is of type string text field
value and line number 28.
I actually created an idea but after integer and the name is into the right and that I put an assignment
operator here and then here I want to actually convert the value of this string value textfield value
to an integer value.
So integer that parse it takes its value right.
So in this way I can actually convert a string value to an integer value.
So I just referred to the name of this integer class and I called the Smurfette parse.
On this class and then I actually passed this value to the Smurfette.
And here is I try to convert that value tway to an integer value and then this can actually be assigned
as value to do this into value valuable.
And now here I am saying that if its value is actually greater than 90 then we are going to assign this
value to this result by the bell which is of type strength.
So result.
Assignment operator your grade is a and your number is Plus its value as if its value is actually greater
than 80.
Result.
Assignment operator your grade is B and your number is Plus into value.
If your grade is actually else into value is actually greater than 70.
Result.
Assignment operator your grade is c and your number is in value.
Else if value is actually greater than 6 the result assignment operator your grade is F and your number
is into value.
And here we have actually an L statement so if none of the conditions above are actually true as you
can see here.
If none of the conditions above is true then it's going to execute this statement else.
Result.
Assignment operator you are not accepted.
Right.
And finally you are actually setting the value you have.
These are two ways to resolve.
So the result that said text resolved right.
So now let's actually on our project and see what happens.
So as you can see here our application is running on the simulator.
So now if we actually passed the value 97 for example here ninety seven and then click on the spot and
show me the result.
It says your grade is a n and your number is 97 right.
So here it is actually executing these statements because this expression evaluates to true the value
of this interval is actually greater than 90 right.
97.
And now let's actually the.
For example another value for example.
Eighty four.
And show me the result.
Now it says your grade is B and your number is 84.
And here is actually again.
Is it this else if statement in value is greater than 70 so let's actually pass a value for example
that is greater than 70 for example 71.
Show me the result.
Now it says your grade is c and your number is 71.
And notice that if it actually passed the value for example 70 here.
Now if I click on this button it says your grade is F and your number is 70.
As you can see here now is going to actually execute this out.
This actually is at this LCF statement.
Its value is greater than 60.
So here as you can see it when I actually created this LCF statement.
I said that if the value of this into value is greater than 17 not equal to 70.
So when we passed the value 70 here is going to execute this LCF statement that actually controls the
values that are actually greater than 60 70 is greater than 60.
So it is that right so that's how I actually decided to actually control these conditions.
If I want to if you wanted to actually check for the seventy two I could put an assignment operator
here.
I could put this actually equal operator so greater than it greater than or equal to 70.
Then it's going to if I pass the value 70 is going to give us the value c for the great.
So that's how you manage your quotes so else if its value is greater than say 60 is going to execute
this line of code here and else.
So we created this Else statement here in order to actually control the conditions that are not actually
specified here.
So for example if none of the conditions above is true then it's going to execute this statement and
it's going to actually show the result to the user.
You are not accepted.
So now let's actually pass the value for example number 50 and then click on the show me the result.
Now it says you are not accepted because of you actually didn't control the values that are actually.
For example a greater than 50 or equal to 50 right.
So hopefully that makes sense and he and as he can see you can see that we are setting this result to
these dx results so this is the X that is off right.
So now let's actually pass another value.
For example let's actually pass our lead here for example a here and now let's click on the spot in
here.
Show me the result.
And now as you can see here our application crashed.
Why.
Because here as you can see if you look at this line of code here.
When I actually been able to actually convert the value of these textfield value to an integer value
as you can see here the value that is assigned for these takes with value must be actually of number
right.
If this value is actually a letter and when you want to actually convert that letter to an integer value.
This method here is going to fail and then it's going to actually crash.
So in order to avoid these kinds of crash Vini to actually provide exception handling here right.
We need to handle the exceptions right.
So I'll talk more about exception handling later in this course but for now remember that because you
actually specified that view that this text textfield value is going to be an integer number.
OK we need to actually passing an integer number into that textfield here.
OK
so as you can see here in this textfield here we must actually passing an integer number OK because
we actually explicitly are determined that we are going to actually putting a value of type integer.
OK we converted this value this textfield value to an integer number and we assign that value to this
into value.
And here we are actually working on this into you here.
OK.
So hopefully this makes sense.
And if you have any questions please post the discussion in the calls and I'll do my best to answer
your questions.
And thank you very much for watching and I'll see you in the next tutorial.