Functions are one of the most useful tools when writing a program. Every programming language including Julia uses functions, it can be for keeping the code simple and readable or to keep the program secure from outside interference. In almost every programming language there are two types of functions:

- Fruitful Functions
- Void Functions

#### Fruitful Functions

These are the functions that return a value after their completion. A fruitful function must always return a value to where it is called from. A fruitful function can return any type of value may it be string, integer, boolean, etc. It is not necessary for a fruitful function to return the value of one variable, the value to be returned can be an array or a vector. A fruitful function can also return multiple values.

**Example 1:**

`# Creation of Function ` `function add_f(a, b); ` ` ` `c ` `=` `a ` `+` `b; ` ` ` ` ` `# Returning the value ` ` ` `return` `c; ` `end ` ` ` `# Function call ` `d ` `=` `add_f(` `3` `, ` `4` `); ` `print` `(d) ` |

*chevron_right*

*filter_none*

**Output:**

**Example 2:**

`# Creation of Function ` `function mul_f(a, b, c); ` ` ` `d ` `=` `a ` `*` `b ` `*` `c; ` ` ` ` ` `# Returning the result ` ` ` `# to caller function ` ` ` `return` `d; ` `end ` ` ` `# Function call ` `x ` `=` `mul_f(` `2` `, ` `4` `, ` `6` `); ` `print` `(x) ` |

*chevron_right*

*filter_none*

**Output:**

#### Void Functions

Void functions are those that do not return any value after their calculation is complete. These types of functions are used when the calculations of the functions are not needed in the actual program. These types of functions perform tasks that are crucial to successfully run the program but do not give a specific value to be used in the program.

**Example 1:**

`# Creation of Function ` `function add_v(a, b); ` ` ` `c ` `=` `a ` `+` `b; ` ` ` `print` `(c); ` `end ` ` ` `# Function Call ` `add_v(` `3` `, ` `4` `) ` |

*chevron_right*

*filter_none*

**Output:**

**Example 2:**

`# Creation of Function ` `function mul_v(a, b, c) ` ` ` `print` `(a ` `*` `b ` `*` `c); ` `end ` ` ` `# Function Call ` `mul_v(` `2` `, ` `4` `, ` `6` `) ` |

*chevron_right*

*filter_none*

**Output:**

## Recommended Posts:

- Julia function keyword | Create user-defined functions in Julia
- Julia end Keyword | Marking end of blocks in Julia
- Julia continue Keyword | Continue iterating to next value of a loop in Julia
- Julia break Keyword | Exiting from a loop in Julia
- Julia local Keyword | Creating a local variable in Julia
- Julia global Keyword | Creating a global variable in Julia
- What does javascript:void(0) mean?
- ES6 | Void Keyword
- Understanding "static" in "public static void main" in Java
- Pure Functions and Modifiers in Julia
- Functions in Julia
- Inverse functions and composition of functions
- Getting lowest and highest value of a Data type in Julia - typemin() and typemax() Methods
- Getting inverse sine and inverse hyperbolic sine in Julia - asin(), asinh() and asind() Methods
- Getting inverse cosine and inverse hyperbolic cosine in Julia - acos(), acosh() and acosd() Methods
- Getting inverse tangent and inverse hyperbolic tangent in Julia - atan(), atanh() and atand() Methods
- Getting sine and hyperbolic sine in Julia - sin(), sinh() and sind() Methods
- Getting cosine and hyperbolic cosine in Julia - cos(), cosh() and cosd() Methods
- Getting tangent and hyperbolic tangent in Julia - tan(), tanh() and tand() Methods
- Counting ones and zeros in binary representation of a number in Julia - count_ones() and count_zeros() Methods

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.