Chapter 13. Functions and the Power of Abstract Thinking
The very concept of a function is chameleon-like: it takes on different aspects when viewed in different contexts. The firstâand simplestâperspective on functions weâre going to consider is that of a code reuse vehicle.
Functions as Subroutines
The idea of subroutines is a very old one, a practical concession to managing complexity. Without subroutines, programming would be a very repetitive affair indeed. Subroutines simply package some bit of repetitive functionality, give it a name, and allow you to execute that bit of functionality at any time simply by referring to that name.
Very often, a subroutine is used to package an algorithm, which is simply an understood recipe for performing a given task. Letâs consider ...
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.