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

iOS

So I am trying to make a quick app the calculates the multiplier of certain teams when players are betting on them.

For example say we have two teams: Team a and team b with starting values of 1 so, also say we have 4 players. The main idea is that the more players that bet on team a, will make the the value of team b go up and the value of team a will go down so that if you bet 20 dollars on team a and 3 other people are betting on it then the value will be 25 cents per dollar won. I'll apply a greater definition if someone doesn't understand, but let me get to the actual part of the question that I need answered.

Basically I have started by creating the teams I have given them arbitrary names so that no one knows what I am doing with this. But basically I have created a enum with 3 teams and inside this enum I have created a function that will multiply the values, and I did it just like one of the swift video says how to do, but I am getting an error when I name two values, naming just one is ok, but the minute that I name two I get an "tuple pattern element label 'num' must be '_'. I don't know what this means and I have tried to search for this and found nothing. I am using swift three I don't know if that makes a difference considering the videos are updated to this version of the language.

Here is the code that is giving me problems:

  enum Teams {
      case blahOne(Float,Float)
      case blahTwo(Float, Float)
      case blahThree(Float, Float)    

      func calcMultiplier() -> Multi {

          switch self {

          case .blahOne(num: let num, multi: let multi): return Multi(num: num, times: multi)
          case .blahTwo(num: let num,multi: let multi): return Multi(num: num, times: multi)
          case .blahThree(num: let num,multi: let multi): return Multi(num: num, multi: multi)
          }
      }    
  }

  struct Multi {
      var num: Float
      var multi: Float    
  }

it is giving me problems in the function where I say "num: let num, multi: let multi"

[MOD: edited code block - srh]