Nepedia
Back to Discover
Independent Reader
💻

Functional programming

technology Maturity 7-9 Next article →

Computers follow sets of rules to run programs. One way to do this is called functional programming. In this style, programmers build big programs using small parts. These parts are called functions. A function is like a little machine. You give it a value, and it gives you a new value back.

In functional programming, functions are very special. They are called first-class entities. This means you can treat a function just like a number. You can give a function to another function as an argument. You can even have a function give back a new function as its result. This lets people combine small parts to make complex tools.

Some people use pure functions. A pure function is very predictable. If you give it the same input, it always gives the same result. It does not cause side effects. A side effect is a change that happens somewhere else in the program. Because pure functions are so steady, they can have fewer bugs. This makes them easier to test. Many famous languages use these ideas. Examples include Haskell, Lisp, and even parts of Python and Java.

188 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.