Solution explanation - Learn Basic Algorithmic Thinking by Building a Number Sorter Step 40

This was easily solved but I don’t understand the fundamentals of parameters. Can someone explain to me how parameters work. In this case with the sort function and being asked to input two the parameters “a” and “b”?

parameters are a conditions or a requirement that needs to be inputed for a particular function inorder to work . In this case , for the sort function to work , we need to specify which all numbers are to be sorted , in this case a and b , these are to be sorted . These then are passed to the function as condition for the function to work and satisfy the conditions within the function to successfully sort

First, I need to understand what a function is. In informal terms a function in programming is a self-contained portion of program that performs a task. Sometimes it can return a result, some times it needs inputs to perform the task.
A parameter is a defined input for a function. When the function is defined the expected input is called parameter.

function myfunction(parameter)
{
   more code here
}

When the function is called to action, the given parameter is called argument.

myfunction(x_here)

x_here is an argument to fulfill the requirement for the parameter .

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.