Introduction to Higher-Order Functions

Get a brief introduction to higher-order functions and when to use them.

Higher-order functions have functions in their arguments and/or can return functions. They are useful for hiding the complexity of tedious and laborious routines. Having functions in input and output enables developers to create simple interfaces to help other parts of the code focus on what matters. For example, let’s see File.open/3 in an IEx session:

iex> File.open("file.txt", [:write], &(IO.write(&1, "Hello, World!")))

Try it below:

Get hands-on with 1200+ tech skills courses.