Functions

Last updated

What is Functions?

Functions in programming are named sections of a program that perform a specific task. They allow us to write a piece of code once and reuse it in different places throughout the program, making our code more modular and easier to maintain. Functions often take in input, do something with it, and return output. Functions can be categorized into four main types:

  • Built-in functions: provided by the programming language, like print() in Python.
  • User-defined functions: written by the user for a specific use case.
  • Anonymous functions: also known as lambda functions, which are not declared using the standard keyword (def in Python, for example).
  • Higher-order functions: functions that take other functions as arguments or return a function.

More in stage 2: Programming Fundamentals

Functions: common questions

Can I learn Functions in Hindi?

This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Functions in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.

Is this Functions tutorial for beginners?

It is lesson 14 of 107 in the free Data Structures & Algorithms roadmap, in stage 2, Programming Fundamentals. If you are new to Data Structures & Algorithms, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.

Still confused? Ask me