In this chapter, we used if
, else
, and when
to make decisions with expressions and branch our code. We saw and practiced with while
, for
, and do
- while
to repeat parts of our code. Furthermore, we used break
for breaking out of a loop before the condition would otherwise allow, and we used continue
to conditionally execute only part of the code in a loop.
It doesn't matter if you don't remember everything straight away, as we will constantly be using all these techniques and keywords throughout the book. We will also explore a number of more advanced ways to use some of these techniques.
In the next chapter, we will take a much closer look at Kotlin functions, which is where all our tests and loops code will go.