Challenge: REPL Arithmetic
Many of the chapters in this book end with one or more challenges. The challenges are for you to work through on your own to deepen your understanding of Kotlin and get a little extra experience.
Use the REPL to explore how arithmetic operators in Kotlin work: +, -, *, /, and %.
For example, type (9+12)*2 into the REPL.
Does the output match what you expected?
If you wish to dive deeper, look over the mathematical functions available in the Kotlin standard library at kotlinlang.org/api/latest/jvm/stdlib/kotlin.math/index.html and try them out in the REPL.
For example, try min(94, -99), which will tell you the minimum of the two numbers provided in parentheses.
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.
Read now
Unlock full access