Welcome to the Treehouse Community
Looking to learn something new?
Why did the playground output .0 and .1 ?
In the video you told us that the .0 and .1 in the playground represent the tuple values but you didn't tell us why the playground does that. So why does it? Can you have three values in a tuple? Would the playground output .0,.1 and .2 if there were three values? Do all IDEs do this?
J.D. Sandifer18,813 Points
Here are your answers in order:
- The playground responds to the .0 and .1 tuple part references because they are built into the swift language.
- Tuples can be any size, that's why they're tuples and not just doubles or duples.
- So yes, three values in a tuple is totally possible.
- .0, .1 and .2 would work if there were three values.
- Yes, all IDE's should work with the .0, etc. because it's part of the Swift language, not just the IDE.