Defining Functions

Defining Functions in Dart

A function definition consists of actual statement that specifies what and how a specific task would do when called. Before using function, it must be defined. The syntax for defining a dart function is given below -

Syntax

void function_name(){
  //statements
}

OR

function_name(){
  //statements
}

The void keyword indicates that the function does not return any value to the caller.

Example- Defining Function

run(){
  //function definition
  print("Function calledd.");
}

code Try Yourself