From the course: Introduction to Dart

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Creating a function

Creating a function - Dart Tutorial

From the course: Introduction to Dart

Creating a function

- [Instructor] Imagine you are a chef in a busy kitchen surrounded by pots and pans and ingredients of all shapes and sizes. Your job is to create delicious meals for your customers and to do that, you need to follow the recipe. Each recipe is like a set of instructions that tell you exactly what to do with each ingredient. You might start by heating up some oil in the pan, then adding some chopped vegetables, followed by a pinch of salt and a dash of paper. Each of these steps is like a function in programming. Just like a recipe, a function is a set of instructions that tell a computer what to do with a given input. It's a way of organizing your code and making it more readable and efficient. To create a function in Dart, you start by giving it a name. This name should be descriptive and tell you what the function does. For example, if you are creating a function that calculates the area of a circle, you might call it…

Contents