Please enable JavaScript.
Coggle requires JavaScript to display documents.
02 Introduction to Methods (Terminology / basic rules syntax…
02
Introduction
to Methods
Terminology /
basic rules
syntax
AKA procedure, sub-routine, function
Signature line
Public / private / static
Return type or void
Method name
Parameter
list
Data type
Parameter name
(by value) / ref / out
Block of code
Use values
from parameters
Return result
(if non-void)
Define a method
Invoke / call a method
Defining and
invoking methods
Capturing the value returned from method
Passing arguments to the method
Calling another method from inside a method
Positional notation
and pass-by-value
Changing value within method
has no effect outside the method
Copy of value passed to the called method
Returning a value
from a method
Use the "return" statement
Execution returns to caller
Caller must store / do something with returned value!
Important / useful
framework methods
Console.WriteLine
Console.ReadLine
Convert.ToInt32
Method
overloading
Multiple implementations
of the same method
Must have unique list of
parameter data types
Alternative versions
of Console.WriteLine
Using {0} {1} {2}... placeholders
Or, use $ notation with inline
{expression} placeholders