Anatomy of a Function
Figure 4.3 shows the two primary parts of a function, the header and body, using obtainQuest as a model:
Figure 4.3 A function consists of a function header and a function body
Function header
The first part of a function is the function header. The function header is made up of five parts: the visibility modifier, function declaration keyword, function name, function parameters, and return type (Figure 4.4).
Figure 4.4 Anatomy of a function header
Let’s look at each of those elements ...
Get Kotlin Programming: The Big Nerd Ranch Guide, 2nd Edition 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.