You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of causing an error, the "list += 3" line successfully inserts another 3 into the list. And the eq test on the next line fails:
[1, 2, 3, 3]
[Error]: [1, 2, 3, 3] != [1, 2, 3]
The text was updated successfully, but these errors were encountered:
You had to have changed val list = getList() to var list = getList() in order to produce that result.
However, I see the problem. list += 3 is creating a new List and re-assigning that to list. It is confusing, because += is doing some tricky things. add() is probably a better way to demonstrate this.
Instead of causing an error, the "list += 3" line successfully inserts another 3 into the list. And the eq test on the next line fails:
[1, 2, 3, 3]
[Error]: [1, 2, 3, 3] != [1, 2, 3]
The text was updated successfully, but these errors were encountered: