loading...
Cover image for User Define function in Dart

User Define function in Dart

jay_tillu profile image Jay Tillu😎 ・2 min read

A user-define function is a function that is created by the programmer for his/her custom need. It provides us the flexibility to reuse our code and divide them in small chunks. Let's discuss how we can create a user-define function in a dart.

First of all, remember, there are two main terminologies behind the use of function:

  1. function definition
  2. function call
  • function definition - It is a time when we define a function. At this time we define its name, work, parameters, and its return type, etc.

  • function call - It is a time when we need the function and we call it. Just remember before you call the function you need to define it. In short first define, the function then calls the function.

There are basically four parts of user-defined function:

  1. function name
  2. parameter
  3. return type
  4. function body

Function definition


It is a time when we define a function. At this time we define its name, work, parameters, and its return type, etc.

Syntax

function_name() {
  //statements
}

Example

SayMyName () {
  print("Jay Tillu");
}

Function calling


It is a time when we need the function and we call it. Just remember before you call the function you need to define it. In short first define, the function then calls the function.

Syntax

function_name ()

Example

SayMyName ()

Sample Program

SayMyName(){
  print("Jay Tillu");
}
main(){
  SayMyName();
}

Output
Jay Tillu
  • Here first we define the function and then we call it from the main function.

This is the basics of function guys. In upcoming articles, we will discuss further in functions. Till then Keep Loving, Keep Coding. And I’ll surely catch you up in next article.

Remember no teacher, no book, no video tutorial, or no blog can teach you everything. As one said Learning is Journey and Journey never ends. Just collect some data from here and there, read it, learn it, practice it, and try to apply it. Don’t feel hesitate that you can’t do that or you don’t know this concept or that concept. Remember every programmer was passed from the path on which you are walking right now. Remember Every Master was Once a Beginner. Work hard and Give your best.

For More Information Please Visit Following Links

Wanna get in touch with me? Here are links. I’ll love to become your friend. 😊
Twitter
Facebook
Instagram
Medium
or just mail me at jayviveki13@gmail.com

Posted on by:

jay_tillu profile

Jay Tillu😎

@jay_tillu

🌏 विधायास्य धमॅस्य संरक्षणम् 🌍 ☀️ Society before Self ☀️ 🙏🏻 Humanism by Religion 🙏🏻 💻 Work for Mankind 💻 🌐 Believes in वसुधैव कुटुम्बकम् 🌐

Discussion

pic
Editor guide