Hello @hheyhey568
Who are the variable1, variable2, and variable3 for you?
If they are variables you want to use in the rest of the equation’s code, the structure could be similar to the following one:
Note that it is a hypothetical equation. The values and operations were selected only to illustrate the implementation of the equations with the function
structure and the use of return
instruction to return the equation’s result.
(function(){
var variable1, variable2, variable3;
if(fieldname1 == 1)
{
variable1 = 12;
variable2 = 34;
variable3 = 56;
}
else
{
variable1 = 21;
variable2 = 43;
variable3 = 65;
}
/* Here the code that uses the variables and very important, return the equation's result */
return variable1*variable2+variable3;
})()
Best regards.