Functions let use reuse code easily by carving off chunks of code and giving it a name.
All functions start with the word func, followed by the function’s name. The function’s body is contained inside opening and closing braces.
We can add parameters to make our functions more flexible - list them out one by one separated by commas: the name of the parameter, then a colon, then the type of the parameter.
You can control how those parameter names are used externally, either by using a custom external parameter name or by using an undersocre to disable the external name for that parameter.
Functions can return value if you want, but if want to return multiple pieces of data from a function you should use a tuple. These hold several named elements, but it’s limlited in a way a dictionary is not - you list each element specifically, along with is type.
Fcuntions can throw errors: you create an enum defining the errors you want to happedn, throw those inside the function as needed, then use do, try, and catch to handle them at the call site.