Seems to work for me: test price-test.tbx (160.3 KB) based on the info above. The test note is ‘zz’. The function is in library ‘tax test’. The addTex() code worked as typed but I tidied the formatting of it up a bit for clarity.
Thanks. For later readers, return is one of the few action code operators that doesn’t take parentheses after it. Accidentally writing the function in this form:
function addTax(price) { return(1.18*price);}
makes the app’s parser—the app reading/interpreting that code—think that the returning statement is in fact an—illegal—input argument for the return operator. The minimum fix required† is to insert a single space after return:
function addTax(price) { return (1.18*price);}
This now indicates parentheses around the price calculation and signals to the parser—if necessary—to multiply pricebefore returning the result.
A more customary—but not required—method of writing such a function would be:
function addTax(price){
return (1.18*price);
}
The changes are essentially ‘white space’. They don’t alter the process but may add clarity, especially those new to action code and/or to coding more generally.
†. When I wrote earlier I’d tested the function ‘as is’, I must have reflexively added the missing space without registering that I had done so. As a TBX is not some high-volume/speed process, writing code in minimal space if often a vector for error. A few slices or line breaks can do much to aid oneself when getting code to work.