So if actually putting a value here for example Number 20 Let's see what happens and then click on this.
Show me the results button here.
So as you can see here it says The value is not 51 and the value is 20.
OK.
So let's actually change these value to another value for example number 51 and then click on this.
Show me the results button here.
So it says 51.
Great.
So it did actually execute these lines of code here.
OK.
So if the value of these are textfield value actually contains this number it's going to actually execute
this line of code here.
OK.
Textfield plus great.
So 51 spacecraft.
And if the value of these are textfield here actually doesn't contain this number here and it it may
contain actually other values or any value.
It's going to actually execute this line of code inside of these else statement here.
OK.
If textfield value that contains 51 is going to execute this line of code here.
But illis and this means anything else.
OK.
If anything else happens if we actually putting any value here it's going to actually execute this line
of code.
OK.
So let's actually delete this 51 and we can actually put in another value for example number 80 and
click on this show me there is at the bottom here and it says The value is not 51 and the value is 80.
OK.
So hopefully that makes sense.
OK so now let's actually go back inside this main activity class here.
And let's actually as you can see here we've got some duplicated Kautsky or KTXA result set text and
TXI the result that said text.
OK.
So we can actually create only one line of code that actually says X degrees and that set text OK.
So there is a solution for this problem here OK.
I don't like actually producing duplicated code in in my program.
OK.
Because that may actually result in bugs.
So in order to solve this problem we can actually create a strange object here named result.
OK.
And then we need to actually assign a value to these valuable here.
OK.
Or an empty variable is enough.
OK.
If you want to you can actually not to assign any value to this variable.
And here we can actually comment out these lines of code here.
OK.
Because I want to show you an important point here and now I can actually assign these values to this
string object here.
OK so I can't just type in here result.
Assignment operator and then I can actually refer to the name of this textfield value object plus.
And then I can actually put into double quotes space.
Great.
OK.
And here again I can actually refer to the name of this result variable result assignment operator.
And then I can actually assign this value to my result variable.
OK.
So as you can see here this result valuable is actually a local variable OK a local variable is a value
but that is actually declared inside of the method.
OK so now as you can see after this if else statement here I can just type in here X the result that
said text and then inside Apprentice's I can just refer to the name of this resolved value.
OK so now let's actually run our project and see what happens.
So now as you can see here I can actually enter a number here for example number 27 and if I click on
the spot in here show me the result as you can see it says the value is not 51 and the value is 27.
So now let's actually did it this value here.
And let's actually put the number 51 here and it says again 51.
Great.
OK.
So as you can see here in this way all our codes are actually more maintainable.
This is a very professional way.
In order to write your code here.
OK.
So now let me actually comment out this if else statement here.
And now let me actually create another if else statements.
So if and then inside the prentices I can actually specify an expression that actually results in a
true all of or a false value.
So I can just type in here.
Textfield value that as you can see here we can actually call D.
All of these methods on our object here.
OK.
So as you can see here Chad.
At what point add.
And lots of other methods.
OK.
So here I can't I just want to actually use that contains Meffert contains and in say the apprentice's.
I can just put in a value for example.
Number 90.
OK.
And then I need to actually open and close my statement by using these curly braces.
So here I am saying that if the value of these textfield value object actually contains number of any
number 90 I want to actually assign a value to this result local variable.
I think as you can see here.
OK.
So result.
And then inside double quotes and just putting in your grade is a.
OK you're great is eight and your number is.
For example I can actually refer to the name of this textfield value here.
OK.
And then I can actually put a semi-colon at the end of my statement.
So now at the end of this statement here I can just type in Ellis if and as you can see here I am actually
using an if statement here this thing.
OK.
So here I am actually specifying that if the value of these takes feel valued doesn't contain the number
90 and it does contain other value for example it may actually contain number 80.
OK that contains.
And then here I can actually specify number 80.
And this time I want to actually assign another value to this result local variable.
OK.
So inside the double calls I can just type in your grade is B and your number is textfield value.
And here I can actually create another LC statement here and then inside the.
I can just refer to the name of this text field text field value that contains and that in say the prentices
I can actually specify that the value of these textfield value may contain number 70.
So I can actually open and close this elusive statement here by using these curly braces.
And then I can actually assign another value to this result local variable.
So I can't just type in your grade is c and your number is textfield value.
OK and now again I can actually create another LCF statement here.
I can actually create unlimited numbers of LCF statements that I want.
OK.
So elusive textfield value that contains number 60.
OK.
So here I can just assign another value with this result variable.
So I can just type in your grade is F and
number is textfield value.
OK.
And now I can actually create an statement here in order to actually specify that if the value of this
text we are right you object doesn't actually contain any of any of these numbers.
1980 76 the.
I can actually specify that the value of this is aren't malleable is.
For example you are not sufficient so hopefully that makes sense.
And let's actually run our project and see what happens.
So now as you can see here our application is actually running on the emulator.
And now for example if I were to enter the value 90 here inside this textfield and if I click on the
spot in here let's see what happens.
Now it says your grade is a and your number is 90 right.
So as you can see here in this code we created an if statement and it says if these tapes fill here
textfield value as you can see here that contains number 90 as you can see here.
Right then we're going to assign the value.
We are going to actually assign a value to the result variable.
Right.
Which is of types 3 as you can see here.
So result assignment operator and then here we are inside the double quotes.
We actually put this value.
Your grade is a and your number is as you can see here your grade is a and your number is Plus textfield
value.
So here we are actually getting the value of this text field.
90 right.
And for example as you can see we actually created another elusive statement.
And here we are saying that else it takes real value that contains number 80 then it's going to actually
assign this value as you can see here to this result.
So your grade is B and your number is takes with value.
So now let's actually change this value to number 80 and click on this button here.
Now it says your grade is B and your number is 80 right.
And now as you can see here we are checking these are conditions here right.
For example number 90 80 76.
So let's actually put an order number for example number 85 and let's click on this button here.
Now it says you are not sufficient.
So now we actually created an else statement here and here we are saying that if these other conditions
above are not true then it's going to actually execute this statement.
So because we actually entered a value that we didn't actually check in say these if else statements
here as you can see we only checked for number 90 80 70 60 right and we didn't actually create actually
a control statement for number 85.
Right.
So in that case it's going to execute this statement.
So this was a statement he had means that he's going to execute this statement if the conditions above
is not true.
OK.
If the conditions above are not true so.
Else and it's going to go inside the curly braces of this statement and it's going to assign this value
you are not sufficient to this result and it's going as you can see here we are saying that he likes
the result.
That's the Tillich's result.
Right.
And now as you can see it says you are not sufficient.
So hopefully that makes sense and if you have any questions about these if statements please post the
discussion in the course and then I'll do my best to answer all of your questions.