Parameters allow functions to share data.
We can define and function to process parameters eg:
#this function adds two numbers and displays the result
public static void addTwo(int num1, int num2):
int total = num1 + num2;
System.out.println("Total: "+total);
}
Then, when needed, we can call the function:
public static void main(String[] args){
addTwo(7,2)
addTwo(0,-2)
addTwo(13,4)
}
Parameters allow functions to share data. They do this by using parameters.
When Function A passes data to Function B, Function B uses its parameters to grab the data and then it can process the data!
This strategy reduces the need for global variables.
module function return identifier parameter pseudocode return typedefinecalldata type