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 trial
Arjun Amin2,228 Points
How does the computer know that the day is a string?
Can someone help me with this?
If you mean how computer know the day and date , that is because the computer have internal db and this db updated by operating system website , so after install the operating system , your computer will connect to the time database and will update your time by your country and region .
if you mean how the computer present the day as string , this is different things because the day is a string we can not today is 6 we will say today is Wednesday .
Sorry but what you mean by your question give example or explain your question .
Ilari Niitamo6,458 Points
With enums you're not working with strings at all. For example, Day.Monday is only a enumeration value. What the function in the video is comparing is two enums - the only thing that is a string is the printout, which is irrelevant. In Objective-C at least you could refer to enums by an index number, as well. So Day.Monday would be the same as 0, so your switch statement could say case 0...4: println("It's a weekday!") and case 5...6: println("It's the weekend!"). I don't yet know if this is possible with Swift, too.
Did that answer your question?