Tuple not working

Why does it give this failable error. In the doc it says it cannot fail.

image

Also tried it with set

I think this example may just be poorly written. I believe it’s meant to show that MyTuple(0) will give an output of 1, not that you set it that way.

If you want to change the value of the tuple, initialize it with var MyTuple : (int, float, string) = (1, 2.0, "three") and then do set MyTuple = (3, 2.0, "one") to change it. If you just want to change 1 variable, you can do set MyTuple = (50, MyTuple(1), MyTuple(2)). I don’t think there is a way to change a single element without re-setting the whole thing, but could be wrong.

2 Likes