Functions
In this module, you will learn how to write and interact with functions in Swift.
StartKey Concepts
Review core concepts you need to learn to master this subject
What is a Function?
Calling a Function
Returning a Value
Multiple Parameters
Returning Multiple Values
Omitting Argument Labels
Parameters and Arguments
Implicit Return
What is a Function?
What is a Function?
func washCar() -> Void {
print("Soap")
print("Scrub")
print("Rinse")
print("Dry")
}
A function is a named, reusable block of code responsible for a certain task. It consists of a definition that includes the func
keyword, name, optional parameters, and return type as well as a body that contains the code block needed to execute its task.
Functions
Lesson 1 of 1
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory