Renderingla

de

Introduces borrowed iteration or borrowed parameters.

Syntax: de <expression>

Category

iteration

Related

Examples

examples/corpus/de/de.fab (canonical · keyword)

Introduces borrowed iteration or borrowed parameters.

# de — borrowed iteration / parameters
#
# GRAMMAR:
#   forDeStmt :← 'itera' 'de' expr 'fixum' ident block
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#
# BACKEND:
#   Cross-ref: itera/de.fab.
#

incipit {
    fixum tabula<textus, numerus> persona ← { "nomen": 1, "aetas": 30 }
    itera de persona fixum clavis {
        nota clavis
    }
    fixum _ numeri ← [10, 20, 30]
    itera de numeri fixum index {
        nota index
    }
}

examples/corpus/itera/de.fab (canonical · keyword)

Introduces borrowed iteration or borrowed parameters.

# itera de — for-in key and index iteration
#
# itera de <objectum> fixum <key> { <body> }
# itera de <lista> fixum <index> { <body> }
#
# GRAMMAR:
#   forDeStmt :← 'itera' 'de' expr 'fixum' ident block
#
# EXPECTED OUTPUT:
#   none — stdout not pinned for this exemplum.

incipit {
    # Iterate over tabula keys
    fixum tabula<textus, textus> persona ← { "nomen": "Marcus", "urbs": "Roma" }

    itera de persona fixum clavis {
        nota clavis
    }

    # Access values using the key
    itera de persona fixum clavis {
        nota clavis, persona[clavis]
    }

    # Iterate over lista indices
    fixum _ numeri ← [10, 20, 30]

    itera de numeri fixum index {
        nota "index: § valor: §"(index, numeri[index])
    }

    # With numerus-valued tabula
    fixum tabula<textus, numerus> forma ← { "alpha": 1, "beta": 2 }
    itera de forma fixum k {
        nota k
    }
}