I am attempting to set up in Handlebars a value that should come out as two separate division math statements added together, then added to another value.
The overall pseudocode of it would be this: result + (var1 divided by 10) + (var2 divided by 100)
My attempt at Handlebars code for it is this: {{plus result (divide var1 10) plus (divide var2 100)}}
How can I adjust the structure of these statements to get these nested math functions to work? Can it work with 3 statements being added together instead of 2 that the plus helper is built around?
First, it isn't clear what
resultis.Second, this sort of logic really doesn't belong in a template. You would be better to do you these math operations prior to sending data to your template function.
However, it would be possible to call your helpers in a nested fashion, but you would need to put each helper call in its own set of parens.
The result would be: