In the previous chapter, we learned how to iterate over the elements of an array, using a for-loop . This allowed us to automate the coloring of our tiles rather than setting the color of each individually. Now we will learn to make choices in our code based on expressions that evaluate as either true or false. Combined with looping, this will allow us to generate complex tile patterns with very few lines of code.
4. Binary Choices
Get Learn to Program with Kotlin: From the Basics to Projects with Text and Image Processing 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.