r/swift•
iosdood

whats the result?

var items:[String] = []   

items.append("apple")

let rem1 = items.remove(at: 0) 

print(items)

if i run this in playground, it's going to say that items is empty since it occurs after rem1. but in a real project rem1 is just holding the value if items does remove at 0. but without actually calling it, it wouldn't happen, hence items is still "apple" right?

Posted Apr 9, 2025, 8:21 PM UTC

06
Loading comments…