Defining a Function
Learn the syntax for defining a function.
We'll cover the following...
We'll cover the following...
Structure of a function
A function is defined in the following way:
This seems rather abstract, but we will see a concrete example in a moment. Here’s a breakdown:
- Return type: On the first line, we have to begin by declaring what data type the function will return once it finishes. We can define a function that doesn’t return anything by using the data type
void.