1 00:00:00,240 --> 00:00:06,810 So operators in Swift and in programming in general, well, the first operator we're going to discuss 2 00:00:06,810 --> 00:00:13,860 is the assignment one this you've seen before, because if I type this statement, the equals symbol. 3 00:00:14,910 --> 00:00:20,430 Is the assignment operator, I am assigning something to a variable in memory space. 4 00:00:21,180 --> 00:00:24,660 Of course it's the same, even if I have a tuple. 5 00:00:25,950 --> 00:00:32,360 I am assigning two things to that people, so X is nine and Y is zero. 6 00:00:32,370 --> 00:00:36,660 In this case, a single equals sign is an assignment. 7 00:00:38,160 --> 00:00:42,320 OK, the next lot of operators, we have our arithmetic now. 8 00:00:42,330 --> 00:00:46,830 This is the category that everyone thinks of when you say the word operator. 9 00:00:47,910 --> 00:00:53,040 So in that case, we'll have something like X plus Y, X minus Y. 10 00:00:53,160 --> 00:00:55,560 You can see where this is going, X times Y. 11 00:00:55,860 --> 00:00:58,410 Notice that that is an asterisk symbol. 12 00:00:58,860 --> 00:01:04,140 It's not a multiplication symbol because X or Times is actually a letter. 13 00:01:04,410 --> 00:01:06,150 So it's reserved for that use. 14 00:01:06,810 --> 00:01:10,880 And then of course we have X divided by Y, which is a forward slash. 15 00:01:11,160 --> 00:01:15,350 So all of these middle sections are the arithmetic opera operators. 16 00:01:15,720 --> 00:01:22,770 We also have stuff such as nine percent four, which is the modulo I think is the word for it, and 17 00:01:22,770 --> 00:01:23,910 this gives us the remainder. 18 00:01:23,910 --> 00:01:28,080 So nine divided by for the remainder of that should be one. 19 00:01:31,130 --> 00:01:37,310 Now, nothing's working, right, if you encounter this in your playground, you will look look at that 20 00:01:37,310 --> 00:01:38,020 horrible error. 21 00:01:40,840 --> 00:01:44,920 Then what you have to do is probably quit your playground. 22 00:01:47,090 --> 00:01:48,920 And then restart everything. 23 00:01:49,520 --> 00:01:50,880 Oh, there we go. 24 00:01:51,110 --> 00:01:51,980 I think that's. 25 00:01:53,070 --> 00:01:55,170 Oh, that's weird, I'm going to restart. 26 00:01:55,200 --> 00:01:55,970 See you in a sec. 27 00:01:56,490 --> 00:02:00,660 So I restarted and I saw what the error was. 28 00:02:01,230 --> 00:02:05,140 X divided by Y is nine, divided by zero, which is infinity. 29 00:02:05,490 --> 00:02:08,320 So what I'm going to do is just do the following. 30 00:02:08,490 --> 00:02:09,330 Put a one there. 31 00:02:10,190 --> 00:02:12,030 Now, we should be all right. 32 00:02:13,010 --> 00:02:13,580 There we go. 33 00:02:14,450 --> 00:02:20,690 It's what we call in programming a picnic problem in chair, not in computer. 34 00:02:22,340 --> 00:02:28,580 OK, so now back to the modulo operator and this gives us a remainder of one because nine divided by 35 00:02:28,580 --> 00:02:29,960 four is to remainder one. 36 00:02:30,500 --> 00:02:32,130 OK, and that is actually very handy. 37 00:02:32,150 --> 00:02:33,590 You'll see what that's like. 38 00:02:34,090 --> 00:02:37,490 You'll use that quite a lot in your programming life. 39 00:02:37,700 --> 00:02:40,290 In fact, in this course, we've already used it a fair amount. 40 00:02:41,060 --> 00:02:46,720 Now, the other thing we have is let's say we have two words and we want to smash them together. 41 00:02:48,390 --> 00:02:52,560 This is called the concatenation operator or concat for short. 42 00:02:53,130 --> 00:02:55,910 This is common to pretty much every language out there. 43 00:02:56,160 --> 00:03:02,760 There are shortcuts to miss out this concat operator and swift, which are slightly easier to type. 44 00:03:03,360 --> 00:03:06,470 But I tend to use these anyway because I'm old school like that. 45 00:03:06,840 --> 00:03:10,320 So that's the concatenation operator. 46 00:03:10,620 --> 00:03:11,610 Now your homework. 47 00:03:12,590 --> 00:03:13,900 Let's get this out here. 48 00:03:15,110 --> 00:03:21,810 Create any two numbers, multiplied them and give the result as a sentence with words. 49 00:03:22,220 --> 00:03:28,820 So I want you to use pretty much all these operators here and then the concatenation operator to do 50 00:03:28,820 --> 00:03:29,070 that. 51 00:03:29,420 --> 00:03:29,930 Good luck.