July 2018
Intermediate to advanced
400 pages
12h 14m
English
IntelliJ not only generated the formatHealthStatus function, but it also added a line in place of the code it extracted:
fun main(args: Array<String>) {
val name = "Madrigal"
var healthPoints = 89
var isBlessed = true
...
val healthStatus = formatHealthStatus(healthPoints, isBlessed)
...
}
This line is a function call, which triggers the function to perform whatever actions are defined in its body. You call a function with its name, along with data to satisfy any parameters required by the function header.
Compare the function header for formatHealthStatus with its corresponding function call:
formatHealthStatus(healthPoints: Int, isBlessed: Boolean): String // Header formatHealthStatus(healthPoints, isBlessed) ...
Read now
Unlock full access