1 00:00:00,210 --> 00:00:08,550 So how did you find that homework, not too easy because because of how I described these things. 2 00:00:08,550 --> 00:00:13,680 Now, when you start to get clients, if you're going to become a freelancer or you're going to work 3 00:00:13,680 --> 00:00:18,420 for an agency, this is the kind of language you can expect, except not as clear as this. 4 00:00:18,420 --> 00:00:26,640 Even though this is rubbish, your clients don't know how to vocalize what they imagine their application 5 00:00:26,640 --> 00:00:27,270 looking like. 6 00:00:28,290 --> 00:00:32,640 So you need to translate requirements into what you can actually code. 7 00:00:33,240 --> 00:00:35,460 Just a fair forewarning for you there. 8 00:00:36,270 --> 00:00:40,530 If you get a client that gives you straightforward specifications, keep them. 9 00:00:40,530 --> 00:00:44,750 They're worth their weight in gold and they probably won't be much trouble for you. 10 00:00:45,540 --> 00:00:45,870 Right. 11 00:00:45,900 --> 00:00:48,780 So the answer to the homework that I came up with was the following. 12 00:00:48,780 --> 00:00:51,990 Add a number and a second number, just integers. 13 00:00:52,350 --> 00:00:54,450 We're going to return a string straightfoward. 14 00:00:56,290 --> 00:01:02,200 They were going to have a function called is greater, will we pass in the number and the max value 15 00:01:02,200 --> 00:01:03,880 that we're comparing it against? 16 00:01:05,350 --> 00:01:11,830 If that number is greater than the max value, we're going to return the string greater than whatever 17 00:01:11,830 --> 00:01:12,670 the max value is. 18 00:01:13,590 --> 00:01:20,910 Otherwise, we'll return less than whatever the Max Vali's then we're going to call the function is 19 00:01:20,910 --> 00:01:25,260 greater with the number and the second number added. 20 00:01:26,310 --> 00:01:28,630 We're going to pass in a max value of ten. 21 00:01:28,800 --> 00:01:33,900 Now, we haven't specified this anywhere else, we just put it straight into the code because that's 22 00:01:33,900 --> 00:01:34,810 just what I said. 23 00:01:34,830 --> 00:01:35,430 Number 10. 24 00:01:36,380 --> 00:01:42,200 And then we're going to return that, so the order of execution is it's going to run the function, 25 00:01:42,620 --> 00:01:48,770 it's going to run the is greater create the string and then pass out that string to whoever called the 26 00:01:48,770 --> 00:01:50,770 function, which I've done here. 27 00:01:51,170 --> 00:01:55,610 So three plus nine is greater than 10 because it's 12. 28 00:01:56,550 --> 00:01:57,660 If we drop that down. 29 00:01:58,680 --> 00:01:59,640 To six. 30 00:02:02,480 --> 00:02:04,400 We should get less than 10. 31 00:02:05,630 --> 00:02:08,810 Now, interesting case, let's get seven. 32 00:02:11,380 --> 00:02:15,730 So the answer here is 10, right, 10 is not less than 10, look what happens. 33 00:02:17,430 --> 00:02:19,380 We get less than 10, do you know why? 34 00:02:20,100 --> 00:02:21,060 Because. 35 00:02:22,320 --> 00:02:26,310 What we have here is logic failure, a logic error. 36 00:02:27,320 --> 00:02:35,660 So greater than or equal to we haven't taken care of the equals to case just greater or less, so what 37 00:02:35,660 --> 00:02:41,320 we need actually in here is to have the equals case. 38 00:02:41,540 --> 00:02:46,040 And if you feel like doing a little extra homework, then by all means, I'm not going to do it for 39 00:02:46,040 --> 00:02:46,300 you. 40 00:02:46,670 --> 00:02:48,060 I'm just going to give you a clue. 41 00:02:48,410 --> 00:02:52,220 It starts with if so, you go ahead and do that one. 42 00:02:52,410 --> 00:02:55,910 See what sense you can make of it, and I'll see you in the next session.