YouSub
Untitled

en English

Untitled English subtitles

0 downloads · 29 lines · added Dec 11, 2015

Report a problem
What's wrong?
Advertisement

English transcript

Now that we understand these lines of code and have practiced typing them,
go ahead and add them to the increment method within the main activity.
Remember that a common beginner mistake is to specify the data type again.
You only need to specify the data type once when you declare the variable.
After that, you can just use the variable name.
If we add a breakpoint on Line 25 and then run the debugger,
we can check what the quantity variable value is at each step.
If I click on the plus button, then the breakpoint on Line 25 is triggered.
I'll click step over to go to the next line of code.
Now we see that the quantity variable has been created with the value of two.
If I click step over again,
then we see that quantity variable has been updated to three.
This is because of the quantity equals quantity plus one line.
Then we can hit play to resume the app and
we can see the latest quantity value being shown on this screen here.
Do the same thing in your version of the app.
Modify the increment method to update the quantity variable
using quantity equals quantity plus one.
Then use a debugger to step through and
verify the quantity variable value at each step.
After that, feel free to experiment with different expressions for
updating the quantity variable.
You could do quantity plus one, or one plus quantity.
Or you could use the variable name twice, or as many times as you want, or
you can do other arithmetic operations.
You can run this on your device to see what happens.
When you're done experimenting, go ahead and revert back to what you had before,
so that we can continue with the lesson.
Check these boxes when you're done.

Need subtitles from another video?