© 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_5

5. Integers

Tim Lavers1  
(1)
Woonona, NSW, Australia
 

Whole numbers, such as 1, 2, 0, –1, –194, and so on, are known as integers. We have already used these as the row and column indexes for our tile patterns and also to define shades of gray. In this chapter, we will be seeing how to combine integers using the familiar arithmetical operators, plus some that you might not have seen before.

5.1 Addition, Subtraction, and Multiplication

To add two integer values together in Kotlin, we use the + operator, and subtraction uses - . The asterisk, * , is used for multiplication.

To see ...

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.