Parameters

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/37

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:34 AM on 7/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

38 Terms

1
New cards

Parameter

A variable in the method declaration

2
New cards

Argument

The actual value supplied to a method when it is called. Gets copied or passed into the method's parameter.

3
New cards

public void DisplayElement(string symbol)

Type an example of declaring a method with one parameter

4
New cards

DisplayElement(“O“);

Type an example of calling a method with an argument

5
New cards

Single Parameter

A method that accepts one piece of information

6
New cards

Multiple Parameters

A method that accepts two or more pieces of information separated by commas.

7
New cards

public void CreateElement(int atomicNumber, string symbol)

Type an example of a method with multiple parameters

8
New cards

Empty Parameter List

Indicates that a method does not require any input values

9
New cards

Return Value

The information a method sends back after it finishes executing

10
New cards

return

Type the keyword that sends a value back to the caller and immediately ends the method.
Use it when the method returns one primary value.

11
New cards

public int GetAtomicNumber()

Type an example of a method that returns an integer

12
New cards

return AtomicNumber;

Type an example of returning an object's property

13
New cards

public string GetClassification();

Type an example of a method that returns a string

14
New cards

public bool IsMetal()

Type an example of a method that returns a Boolean value

15
New cards

public Element Search(string query)

Type an example of a method that returns an object

16
New cards

public List<Element> GetElements()

Type an example of a method that returns a collection

17
New cards

void

Use the following keyword, when a method performs an action but does not need to send any value back.

18
New cards

Matching Return Type

The value returned by a method must match its declared return type.

19
New cards

Missing Return Statement

A compile-time error that occurs when a non-void method finishes without returning a value.

20
New cards

Passing by Value

The default behavior in C#. A copy of the argument is passed into the method. Changes made inside the method do not affect the original variable.

21
New cards

Passing by Reference

The method receives direct access to the original variable instead of a copy. Changes inside the method affect the original variable

22
New cards

ref

Type the keyword used to pass a variable by reference. Both the caller and the method must use the keyword

23
New cards

out

Type the keyword used when a method needs to return multiple values through its parameters. The method must assign a value before it finishes

24
New cards

params

Type the keyword that allows a method to accept a variable number of arguments of the same type.

25
New cards

Optional Parameter

A parameter that has a default value. The caller may choose to omit it

26
New cards

public void Print(string message = "Hello")

Type an example of an optional parameter

27
New cards

Named Argument

Allows arguments to be supplied by parameter name rather than position

28
New cards

CreateElement(symbol: "O", atomicNumber: 8);

Example of a Named Argument

29
New cards

Positional Argument

Arguments supplied in the same order as the method's parameter list.

30
New cards

Input Parameter

A parameter whose purpose is to provide information to a method

31
New cards

Output Parameter

A parameter whose purpose is to send information back to the caller using “out” keyword

32
New cards

out

Use it when the method that needs to return multiple values

33
New cards

Method Input

The data received through parameters before the method begins its work

34
New cards

Method Output

The value produced after the method completes its work. Usually returned using the ‘return’ keyword.

35
New cards

Parameters make methods reusable. Instead of writing separate methods for Oxygen, Carbon, and Hydrogen, one method can work for all elements by receiving different arguments.

Why do methods use parameters?

36
New cards

Use parameters whenever the method needs information that may change between different method calls

When should a method use parameters?

37
New cards

Constructor Parameters

Also use parameters to initialize newly created objects with their starting values. These parameters are discussed in detail in the Constructors deck

38
New cards

,

Separates multiple parameters inside a method declaration or multiple arguments inside a method call.