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
Kolya Masayev
Courses Plus Student 323 PointsSwift2 problems
I have the code that I have learnt in here, but i keep having a mistake in my XCode
case: "Monday", "Tuesday" , "Wednesday" , "Thursday" , "Friday"
return "It's a weekday"
case: "Saturday" , "Sunday"
return "It's a weekend"
saying expected pattern and that there must be ; <- this sign not -> , this one
i keep changing it and nothing happens
1 Answer
Jhoan Arango
14,575 PointsHello:
When using cases in a switch statement you have to put the colons after the values.
switch days {
case "Monday", "Tuesday" , "Wednesday" , "Thursday" , "Friday": // colon placement
return "It's a weekday"
case "Saturday", "Sunday":
return "Yay ! it's the weekend"
}
// No
case: "Monday"
// Yes
case "Monday":
Good luck
Kolya Masayev
Courses Plus Student 323 PointsKolya Masayev
Courses Plus Student 323 Pointsthnx! I guess you will need to change the videos there
Jhoan Arango
14,575 PointsJhoan Arango
14,575 PointsKolya Masayev, the videos are fine I just double checked. It shows the proper placement of the colons. But these small mistakes happen a lot.
Happy Coding my friend