#Loop over mutable pointers to ArrayList elements

1 messages · Page 1 of 1 (latest)

alpine wing
#

do |*item|

thorny thunder
#

ahh okay

alpine wing
#

it's const by default so you need to treat it as a pointer to modify

empty vigil
#

try this:

for (list.items) |*item| {
    try item.append(1);
}
thorny thunder
#

yep that works thanks guys

alpine wing
#

also yeah, try

thorny thunder
#

I'm not actually appending, just example but yeah

empty vigil
#

lol i didnt even notice that, just autocompleted that in

thorny thunder
#

lol

#

i am not familiar enough with zig to know off the top of my head what can fail and what can't