Chapter 8. Java Decisions and Loops
We have just learned about variables. We know how we can change the values that they hold with expressions, but how can we take a course of action that's dependent upon the value of a variable?
We can certainly add a number of new messages to the number of previously unread messages, but how might we, for example, trigger an action within our app when the user has read all their messages?
The first problem is that we need a way to test the value of a variable and then respond when the value falls within a range of values or is a specific value.
Another problem that is common in programming of all sorts is that we need sections of our code to be executed a certain number of times (more than once or sometimes not ...
Get Android Programming for Beginners - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.