# 4: Introduction to Functions


In any language, the function is one of the most important ideas and this chapter covers the introduction of functions with examples in julia. There are three main purposes of functions in scientific computation.

1. A function in a computer language mimics that of a mathematical function, which are crucial in this field.

2. Functions simplify code. Wherever code is repeated either exactly or nearly exactly, functions are one way to reduce the amount of code written and makes code conceptually easier.

3. Functions abstract code. If you can create a piece of code that does a particular task, then this helps in the abstraction process.

4. Functions allow separation of code. If there is a large code and a section of it does a specific task, making it a function will separate code.

The Julia documentation on functions is a has additional information on functions and we will cover some advanced features of functions in Chapters XX and XXX

This page titled 4: Introduction to Functions is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Peter Staab.