Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Swift

Hello. I'm stuck at the switch statement chalenge and I would need some help to solve it.

What have you tried so far, where are you getting stuck?

I'm getting stuck at the the switch statement.... I'm not sure if know hoe to use properly. I can send u screenshot if that could help.

1 Answer

switch (condition)
  case "a": // in other words if condition == a
     // action a (for example europeanCapitals.append(value)
  case "b":
    // action b
  default:
    // fallback action when neither of the cases match

you could use key as your condition and append the value to the right array.

You'll have to make some kind of lookup table for which city belongs to which continent.

Im not sure how to make an lookup table or what do u mean by that, Im learning swift for a short time