Parameters – A parameter is a value that you can pass to a function in Dart. Then the function can use the parameter as though it were a local variable initialized with the value of the variable passed to it by the calling function. In simple words, parameter helps to pass values into function.
Arguments – An argument in dart is the value passed to the variables defined in the function when the function is called. Whenever the function is called during the execution of the program, arguments are passed to the function. An argument when passed with function, it takes the place of those variables which are used during the function definition and the function is executed with these values. In simple words, arguments are that value which passes through parameters into function.
The syntax of function prototype is:
<return_type> <function_name>(<arguments>);
- int main()says to compiler that it is going to return an integer…..
The purpose of main()’s return value is to return an exit status to operating system.
“return 0;” tells the os that program execution is successful.
if we return any other integer it tells that some error occurred —-it has just to do with os.
- 2. void main() returns nothing…no need of return statement.
Let’s understand through an example…
Code 1:
void main(){ // int s -> parameters void car(int s){ print(‘car speed is $s K.M/H’); } // argument -> 80 car(80); } |

Calling function – This calls another function inside it.
Called function – This function get calls by another function.
** From the above code, function main() is calling function and function car() is called function. Value ‘80’ is argument and ‘int s’ is the parameter of car() function.
Let’s understand another parameter and argument example…
Code 2:
import ‘dart:io’; String student(String s){ print(‘student name $s’); return s; } // calling function -> main() void main(){ String? name; print(‘Enter Name: ‘); name=stdin.readLineSync(); // stdin.readLineSync() can potentially return a null value if (name!=null) { // called function -> student() student(name); } } |

Let’s work with multiple different parameters [int String Char] and its corresponding arguments.
Code 3:
import ‘dart:io’; // s,p,pr -> formal arguments void student(String s,int p,double pr){ print(‘student name $s’); print(‘phone number is $p’); print(‘percenatage is $pr’); } void main(){ String? name,phone,per; int ph;double percen; print(‘Enter Name: ‘); name=stdin.readLineSync(); print(‘Enter Phone Number: ‘); phone=stdin.readLineSync(); print(‘Enter percentage: ‘); per=stdin.readLineSync(); if (name!=null && phone!=null && per!=null) { ph=int.parse(phone); percen=double.parse(per); // name,ph,percen -> actual arguments student(name, ph, percen); } } |

From the upper code, you will see function ‘student’ has three different type parameters – string, int and double.
Formal & Actual argument – actual arguments are the values used in call of the function, while formal arguments are variables named in the parenthesized list in a function definition. Formal arguments receive a copy of actual arguments when function is called.
From the upper code, you will see formal and actual arguments.
Formal & Actual parameters – A formal parameter must be a name, that is, a simple identifier. A formal parameter is very much like a variable, and — like a variable — it has a specified type such as int, boolean, or String. An actual parameter is a value, and so it can be specified by any expression, provided that the expression computes a value of the correct type.
Let’s see another code example…
Code 4:
// function car() has 3 different parameters -> s,n,p void car(String s,int n,double p){ print(‘car name $s’); print(‘car speed $n’); print(‘car price is $p’); } void main(){ car(“TATA”,70,420000.00); } |

That’s why we pass different set of arguments (values). Remember: when we deal with multiple different parameters, we need to passes same state of arguments. If you want to return any type of value from function you can use primitive data-types (int, char, double). Functions are designed to return something, but when we don’t specify which type of value it will returns then we can use ‘void’ keyword. |
Let’s make a code, which will return sum of three integers.
Code 5:
void main(){ int sum(int x,int y,int z){ int s=x+y+z; return s; } int res = sum(10,20,30); print(‘result of sum $res’); } |

If you look into upper code, you see we mentioned ‘int’ before function ‘Sum’. It’s mean this function will return an integer value.
Let’s make a code, which will takes three double values and returns summation of them as integer form. Perform different set of inputs 2 times.
Code 6:
int dbleSum(double a,double b,double c){ double s=a+b+c; int sum=s.round(); return sum; } void main(){ late int d; d = dbleSum(10.2, 20.4, 30.4); print(‘sum is $d’); d = dbleSum(20.3,30.5,60.6); print(‘sum is $d’); } |
