So how did you find that homework, not too easy because because of how I described these things.
Now, when you start to get clients, if you're going to become a freelancer or you're going to work
for an agency, this is the kind of language you can expect, except not as clear as this.
Even though this is rubbish, your clients don't know how to vocalize what they imagine their application
looking like.
So you need to translate requirements into what you can actually code.
Just a fair forewarning for you there.
If you get a client that gives you straightforward specifications, keep them.
They're worth their weight in gold and they probably won't be much trouble for you.
Right.
So the answer to the homework that I came up with was the following.
Add a number and a second number, just integers.
We're going to return a string straightfoward.
They were going to have a function called is greater, will we pass in the number and the max value
that we're comparing it against?
If that number is greater than the max value, we're going to return the string greater than whatever
the max value is.
Otherwise, we'll return less than whatever the Max Vali's then we're going to call the function is
greater with the number and the second number added.
We're going to pass in a max value of ten.
Now, we haven't specified this anywhere else, we just put it straight into the code because that's
just what I said.
Number 10.
And then we're going to return that, so the order of execution is it's going to run the function,
it's going to run the is greater create the string and then pass out that string to whoever called the
function, which I've done here.
So three plus nine is greater than 10 because it's 12.
If we drop that down.
To six.
We should get less than 10.
Now, interesting case, let's get seven.
So the answer here is 10, right, 10 is not less than 10, look what happens.
We get less than 10, do you know why?
Because.
What we have here is logic failure, a logic error.
So greater than or equal to we haven't taken care of the equals to case just greater or less, so what
we need actually in here is to have the equals case.
And if you feel like doing a little extra homework, then by all means, I'm not going to do it for
you.
I'm just going to give you a clue.
It starts with if so, you go ahead and do that one.
See what sense you can make of it, and I'll see you in the next session.