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
Patrick Li
2,434 PointsWhen using a method from a enum, why cant you write DayofWeek.daysTillWeekend(DayofWeek.Monday)
in the code, amit shows that you can write:
var today = DayofWeek.Monday
then
today.daysTillWeekend(today)
what i dont understnat is why can't I write:
DayofWeek.daysTillWeekend(DayofWeek.Monday)
1 Answer
Nathan F.
30,773 PointsThere's no reason you couldn't do that, so far as I know. but the example Amit shows is closer to what would happen in an actual application. Suppose you have a bunch of functions and methods in your application, and one of those returns the current day as your Day enum type. You would want to capture that returned data and then use it in another function, rather than explicitly type out what day it is--because the day is going to change, after all.