In the last chapter, we wrote some Kotlin code to calculate the circumference of a circle. In this chapter, we’re going to write some functions that will make it easy to calculate the circumference of any circle!

If you’re just landing here and you’re new to the Kotlin language, be sure to head back to chapter one and catch up!

Functions

As we saw in the last chapter, calculating the circumference of a circle is easy:

And here’s some Kotlin code that we wrote to do that calculation: