© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
T. LaversLearn to Program with Kotlinhttps://doi.org/10.1007/978-1-4842-6815-5_3

3. Arrays and Loops

Tim Lavers1  
(1)
Woonona, NSW, Australia
 

In the previous chapter, we worked on a program that built patterns of black and white tiles that corresponded to the elements of a square array. In this chapter, we will introduce a powerful syntax that allows us to build larger patterns from shorter programs.

3.1 Array Indexes

Recall from Chapter 2 that an array is a list of values. An array of arrays is effectively a grid, and our programs so far have used these to represent rectangular patterns of black and white tiles. In these programs, we have used the library ...

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.