Hello, welcome to the 21st tutorial in a swift programming series, and we'll be looking at enumeration. enumerate allows you to define a common type for a group of related values which allow you to work with values in a type safe way, manner within your code. So let's just open up that project. It's quick now this is probably gonna be the last tutorial in this programming series. We'll be doing more swift tutorials. And eventually you'll probably be when swift actually finally released often our we believe this is enough but you can always message us and we will help as best as we can.
So to create a numerator you do enough that's the key word. Then you type in this name and then Congress then you put formula and then data type and put in and what we're gonna do his case then you put The name dunk but no. Case. Self can't. West. Okay.
East not eat. Never mind eating food crinkling line. I'm gonna put comm PERS dot North Misra printer, you'll see some pretty weird shave. enormous value. Don't say number, but it is a number is basically a particular value. This is an enumerated member value.
That is a good way of what's the best way of putting it. You know, maybe using a as some sort of ID or reference point. This way, if I try and do some thorough check, so let's just check in Something in north south west or east. There is no way if I summon sometime number was to be put in that it would accidentally pick up north, south, west or east even though that number could be useful home for now. But this is still technically considered an interior. That's probably the best way I can think of explain.
It should also put each numerator member value aka each case on a single line, but you have to separate it with a comma. I prefer it like this and he said or Nita, she's only got two or three or maybe four you can put in one lump if you have a lot, and they're quite big, then it's probably recommended that you have it on separate lines. Okay, yeah, that's it for this tutorial. I think just wanting to know, before we go, if we didn't do this, but we'll do this now. It has read commenting to comment to code basically led you to annotate it and love you to comment out code so it's not been run. So I'm going to comment with two forward slashes and then have gone green so this will not arise anymore.
I mean, that annoying. You can also comment, use them for slash four slash asterik then asterik four slash to end that con that's a multi line comment, or this is Monica this isn't declared anymore, but what are some common words or some comment in second and then to false lashes is a similar comment and it's not just for commenting go look so before annotate this prints out stuff for them probably that's a little thing comment in other languages. That's it for this tutorial. For any question feel free to message us at support Asana system, curry UK, the email will be in the description you can comment on the video directly messages via YouTube, or the record link for source code will also be in the description and as usual, thanks for watching and have a nice day.