[MUSIC] So now let's take a look at how we can define methods on an enumeration type. Methods are just functions but when we define a function on a type we call them a method. All right, so lets look at how we can actually use those methods. We just looked at them to learn about how we can use switches with emails. I want to go look at them now and talk a little bit more about how we can actually use the function, or use the method. How do we call a method, or how do we call the function on any known type, etc.? And it should be very familiar to us. Declare that a method can change self's value with the keyword mutating. So with enums we have the one requirement that if the method changes any of the values of the enum types properties or the instance of the enum if we change its properties. Then we need to preface our method with the keyword mutating. All right, and that's something that's unique to this enumeration type. All right, let's go to the program and take a look at that. All right, so here we are again looking at our showMoonCount and showMoonNames functions. Now, again, notice the placement of these functions. They are inside of my body of my enum, right? And I know that because of these curly braces. By the way, if you double click on a curly brace, it will highlight the entire scope that the curly braces enclose. Okay, so if I look at the curly braces of MilkyWayPlanet, I can see that these two functions showMoonCount and showMoonNames are inside of its scope. And that's why we call them methods. So now we've seen how we can declare these functions or declare these methods, we just do it the same way that we do with any function, we have the func keyword, the name of the function, inside of parentheses Any arguments that the function will take. In this case, we don't have any arguments because we're just going to be looking at self. And we saw in the previous example how we switch over self. And we just print statement, the number of moons for every planet. All right, also similar with the showMoonNames method, keyword funk, the name of the function. Any arguments inside of the parentheses in this case, again there are none, because we're just clicking itself, which again, is an instance of this enumeration type. So in other words, in our case, it's going to be a planet. And we go over every case that we're interested in listing the planets out for, and we go ahead and print that list out to our console. Or if there's just too many moons to list like some of the planets we saw have 53 moons. I didn't want to type out 53 moons in this code, because it would become difficult for you to look at, but we'll define a default case and just say, hey if it's not one of these planets, that it's kind of reasonable to show the moons for We'll have a default case and it says this planet has too many moons to list. All right, so now we've declared our functions, that should be very familiar. Now let's look at how we can use those functions. I want to show you one more thing as long as we're talking about adding functions or methods to a type. We can also add properties to a type. Now as we saw earlier we cannot add a stored property to an enumeration type, right? If I uncomment this again, I get the error enums may not contain stored properties. So that's a no-no. But I can have computed properties and that's okay. We'll learn more about properties. But here I have a computed property called order of type int. And again, this is going to be the order that the planets come in, in terms of their distance from the sun. So it's a very simple property and I'm just going to return Self.rawValue because again, we've listed out the planets in that order already. And we've seen how [COUGH] the planets get their associated int raw value type automatically starting at zero and then going down the list of cases one, two, three, etc. So that will all work out because we did a good job of listing out the cases in that order. [MUSIC]