It is possible to define your own functions in sass and use them in any value or script context.
Functions can access any globally defined variables as well as accept arguments just like a mixin. A function may have several statements contained within it, and you must call @return
to set the return value of the function.
As you will see in the following example, creating a function that allows for custom arguments based on global values and uses Sass operations can be a powerful tool.
operations_inside_function.scss