F# is a functional programming language. It contains rich set of built-in functions. It allows us to create user-defined functions also.
You can define function by using let keyword, and recursive function by using let rec keyword combination.
let: It is a keyword which is used to define function.
Inline: It is optional and used to create inline function.
function-name: Function-name is a valid function name that represents the function.
parameter-list: Parameter-list represents list of parameter in the function.
return-type: You can use return-type to tell about the return type of function. It is optional.
function-body: It is a block of statements.
F# Function with No Explicit Return Type Example
Hello F# Programming
F# Function with Explicit Return Type Example
F# Recursive Function Example
When a function call itself is called a recursive function. Recursive function helps to optimize code. It must have a base case to terminate recursive call safely.
Following recursive function is used to print nth Fibonacci number.