CHAPTER 5

image

Functions

You may remember the concept of functions from a math course. Or, perhaps they are a completely foreign concept to you. Either way, they are one of the basic units used for organizing source code. In some programming languages, functions go by another name, such as subroutines or procedures. In Dart, functions can stand on their own or be a part of objects. In the latter case, they are known as methods and are covered in Chapter 10.

What Is a Function?

Functions are not strictly necessary to write programs. Indeed, other than using the main() function as an entry point for our programs, we have not actually been actively creating ...

Get Dart for Absolute Beginners 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.