4 Functions: Many Are Called
From the earliest days of computers, one of the major goals of programmers has been to avoid having to write the same group of statements over and over. This is the search for reusability, and it is a major reason why object-oriented programming (OOP) was developed. But the most basic technique for writing reusable code is the use of functions—often known as procedures or subroutines in other languages.
A function is a group of related statements that accomplish a specific task. Once you define a function you can execute it whenever you need to. Beyond that functions provide a way to divide a complex program into smaller, more doable tasks. Without this division of labor, serious programming would be just about impossible ...
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