Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeremy Sabath
3,018 PointsWhat type is cards when it's declared as a constant?
When Amit declares
let cards =
what is its type?
3 Answers
Stone Preston
42,016 Pointsamit types
let cards = 1...13
using the ...
syntax creates a range, so cards is a constant of type range.
Kai Aldag
Courses Plus Student 13,560 PointsHey Jeremy,
that isn't valid swift code, nor would something like this ,
let cards
if you do what you said Xcode says "expecting initial value after '=' ". so I'm not sure what you means because the code you said ins't valid.
Best, Kai
Kai Aldag
Courses Plus Student 13,560 PointsOk as stone says, the 1...13 make a range.
Mike Atkinson
6,882 PointsIn Xcode, if you hold option and click on where you declare "cards", it will tell you:
declaration: let cards = Range<Int>
So, the type would be a range, specifically a range of integers.