Lesson 6: Defining a Function
Lesson 6: Defining a Function
You learned in Lesson 5 that a function is reusable code that provides instructions for performing an action, or for creating an output based on input.
You learned in Lesson 5 that a function is reusable code that provides instructions for performing an action, or for creating an output based on input.
To define a function, you need three key parts: a unique identifier, the type of information to expect as its result, and what the function will do when it's called.
How to Define a Function
Function Signatures
In Lesson 3, you saw how to declare a variable or constant by naming it and giving the type of value it will use.
A function signature works in a similar way. The function signature uses a unique identifier for the function, along with the parameters that describe the input it will need, and finally, the return type for the result, or output.
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.