Nepedia
Back to Discover
Independent Reader
💻

Parameter (computer programming)

technology Maturity 11-13 Next article →

Computers use sets of rules called functions. To work, a function often needs information. This information is called an argument.

Inside the function, there are empty spots. We call these spots parameters. You can think of a parameter as a placeholder. An argument is the real value that fills that spot. For example, a rule might add two numbers. The rule uses two parameters to hold the numbers. When you use the rule, you give it two arguments, like 2 and 3.

There are different ways to pass these values. In call by value, the function makes a copy. The function uses the copy to do its work. In call by reference, the function uses the original variable.

Some rules have a default argument. This is a value the computer uses if you do not provide one. You can also have a variable-length list. This lets a function take any number of arguments.

It is important to match the lists. If you give too many or too few arguments, errors can happen. You must also give the right type of information.

182 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.