Custom Functions
Define custom functions to reuse throughout your notebook, making calculations easier to understand.
If you don't want to define your own, Decipad already supports a list of basic functions out of the box:
Decipad Functions List →
Create Custom Functions
CustomFormulaName (first argument, ..., last argument) = your custom expression
To create a custom function in Decipad:
-
Add an Advanced formula block by clicking the
+
button next to an empty line and selecting "Advanced formula". -
Choose a unique name for your custom function that differs from any variables or unit name.
-
Specify the arguments for your custom function by separating them with commas and enclosing them in parentheses
(first argument, ..., last argument)
. These arguments are the variables that can be reused in your formulas. -
Define your custom function using an equal sign, followed by your custom expression
= your custom expression
. -
You can now reuse your custom function in other formula blocks by calling it as
YourCustomFunction(YourArguments)
.
Example
Let's consider an example where you want a custom function that always applies a 10% discount to a price.

- 1.Start by defining your custom function
applyDiscount(Price) = Price - 10%
on an Advanced Formula block. - 2.Then reuse it on any formula block just by calling its name and passing the arguments.
In this case:Price
.

Custom functions can have more that one argument. Just separate them with a comma.
- 3.On this example lets consider a special discount for your VIP clients. Add an extra argument to help with your custom formula logic called
ClientTier
. - 4.Reuse your custom function
ApplyDiscount(Price, ClientTier)
in any other formula block.
For aPrice = $100
the discount will be20%
, totalling$80
.

The advantage of custom functions is that you can reuse your calculations with different inputs.
- 5.For example, when you apply a discount for a regular customer on a
Price
of$100
, they will pay$90
.
A10%
discount. - 6.Your VIP customer will pay
$160
on a purchase of$200
. A20%
discount.