O'Reilly logo

Start Here!™ Fundamentals of Microsoft® .NET Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parameters

To make a routine more flexible, you can pass parameters to the routine to give it extra information that it can use to perform its task. For example, suppose that you write a routine to print a student’s course schedule. You could make the routine receive a parameter that gives the ID of the student whose schedule it should print.

Giving the routine a parameter makes it much more flexible. In this example, it allows one routine to print the schedule for any number of students instead of just one.

Exactly how you define a routine’s parameters depends on the language you are using, but the idea is the same in every language. The routine’s declaration includes declarations for any parameters that it will take.

For example, the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required