Skip to Main Content
Android Programming with Kotlin for Beginners
book

Android Programming with Kotlin for Beginners

by John Horton
April 2019
Beginner to intermediate content levelBeginner to intermediate
698 pages
15h 15m
English
Packt Publishing
Content preview from Android Programming with Kotlin for Beginners

Chapter 8. Kotlin Decisions and Loops

We have just learned about variables and we now understand how to change the values that they hold with expressions, but how can we take a course of action that is dependent upon the value of a variable?

We can certainly add the number of new messages to the number of previously unread messages, but how can 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 equal to a specific value.

Another problem that is common in programming is that we need sections of our code to be executed a certain number of times (more than once or sometimes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Android with Kotlin

Programming Android with Kotlin

Pierre-Olivier Laurence, Amanda Hinchman-Dominguez, Mike Dunn, G. Blake Meike
How to Build Android Apps with Kotlin - Second Edition

How to Build Android Apps with Kotlin - Second Edition

Alex Forrester, Eran Boudjnah, Alexandru Dumbravan, Jomar Tigcal
Java to Kotlin

Java to Kotlin

Duncan McGregor, Nat Pryce

Publisher Resources

ISBN: 9781789615401Supplemental Content