Legend of liquid array for Developing Email Template

I wrote a better way referenced to Lubos post. on Request to add variables into email body - #9 by lubos

and Based on @sharpdrivetek gracious shared template.

Subject
Invoice Number {{ reference }} due to {{ business.name }} ({{ business.identifier }})

Message Body
{% for total in table.totals %}{% if total.label == ‘Total’ %}{% capture invoice_total %}{{ total.text }}{% endcapture %}{% endif %}{% endfor %}
{% for field in fields %}{% if field.label == ‘Invoice date’ %}{% capture invoice_date %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% for field in fields %}{% if field.label == ‘Due date’ %}{% capture due_date %}{{ field.text }}{% endcapture %}{% endif %}{% endfor %}
{% for total in table.totals %}{% if total.label == ‘Balance due’ %}{% capture balance_due %}{{ total.text }}{% endcapture %}{% endif %}{% endfor %}

    Greetings {{ recipient.name }},
    Please find herewith attached your Invoice Number {{ recipient.code }}-{{ reference }} dated {{ invoice_date }} due by {{ due_date }}
    The Invoice value is {{ invoice_total }}
    The balance amount due is {{ balance_due }}
    If payment have yet to be made, please pay to the following bank account:-
    <i>Bank:</i> <b>Zionist owned Bank namely IMF</b>
    <i>Account Holder:</i> <b>James Bond</b>
    <i>Account Number:</i> <b>777</b>

    Your People's Leader,
    Gadaffi from Libya

I need help of how to write up if logic like if there is no balance due it will display 0 and if there is no due date either display none or no due date template word. If there is example I am very appreciate.

Reference by @isklerius

2 Likes