Hi there,
I’m being driven crazy by a very straightforward problem. The issue isn’t the logic as much as it is figuring out how to accomplish what I need with Hubl.
I have an array (list) of numbers. I’m trying to accomplish the hubl equivalent of Javascript’s += addition assignment.
{% set bee = 10 %}
{% set sees = [1, 2, 3] %}
{% for see in sees %}
{% do bee = bee - see %}
{{ bee }}
{% endfor %}
{{ bee }}
I want 10 to equate to:
1. First loop: 10 - 1 = 9.
2. Second loop: 9- 2 = 7.
3. Third and final loop: 7 - 3 = 4.
bee = 4. That’s all I want.
I’m also getting the baffling error that can be seen in the screenshot, which I can’t begin to comprehend. I’ve tried to use the |int filter in case the integer wasn’t being processed as an integer.
Someone please put me out of my misery. How do I do this with Hubl? I can accomplish with JS, but I think I’m just missing something here.
I would really, really appreciate any feedback - particularly the helpful kind.
Thank you!
