Passing Arguments in Subroutines

Learn how you can pass arguments to a subroutine in this lesson.

What are the arguments?

The parameters of a subroutine accept values passed to them when that subroutine is called. The values passed are referred to as arguments of a subroutine. There are some tasks that do not require any arguments, for instance when we ask someone to come upstairs, it is understood which floor we are talking about. But some tasks require additional pieces of information. For instance, when we ask someone to cook, we have to tell them how many people to prepare a meal for.

Let’s look at the structure of a subroutine when we have passed arguments to it:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy