การเรนเดอร์th-TH

ที่

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

One shared at [i] coordinate on a lockstep list walk.

Syntax: for from <a>, <b> at [i] const <x>, <y> { }

Category#

control-flow

Examples#

radix/corpus/itera/lockstep-at-index.fab (canonical · keyword)#

One shared at [i] coordinate on a lockstep list walk.

# =============================================================================
# lockstep at [i] — the shared coordinate does not grow with the ซีรีส์.
# =============================================================================
#
# What this teaches:
#   • the optional `at [i]` clause names the walk's shared index — ONE
#     coordinate for the whole ซีรีส์, whether N is 2 or 3
#   • on one list the coordinate clause still requires a shaped iterable
#     (เทนเซอร์/matrix rank); on a list zip it is exactly the shared index
#
# Common mistakes:
#   • writing `at [i, j]` for two sources — the coordinate count never grows
#     with N; that spelling is a check error on a list zip
#
# See also: ที่, วน
# =============================================================================

main {
    const list<string> labels ← ["a", "b", "c"]
    const list<int> values ← [1, 2, 3]
    for from labels, values at [i] const label, value {
        print i
        print label
    }
    const list<int> bases ← [100, 200]
    const list<int> keys ← [1, 2]
    const list<int> payloads ← [10, 20]
    for from bases, keys, payloads at [slot] const base, key, payload {
        const int total ← slot + base + key + payload
        print total
    }
}

Expected output:

0
a
1
b
2
c
111
223