video

Lesson video

In progress...

Loading...

Hello, and welcome to lesson three of our programme unit.

Now this lesson is all to do with selection.

All you'll need for today's lesson is access to the website scratch, and if you haven't got an account and you're under 13, remember to ask your parents, carers or teacher to set you up with an account in advance.

So if you can clear away any distractions that you might have turned your phone off, maybe if you can find a nice quiet place to work, that'd be brilliant, and when you're ready, let's begin.

Okay so in this lesson, we're going to learn about true or false expressions, we're going to learn how to use expressions in what we call selection statements, so we'll learn about that later on in this lesson.

And then you can to modify a programme to include those selection statements.

So, first of all, we're going to start off with a little game.

So what I'd like you to do is read that sentence on the screen and then evaluate it.

So work out whether or not you think that statement is true or false, okay.

So if you think you're going to use off thumbs for this, so you don't have your thumbs up like this, and then if you think it's true, you're going to put your thumbs up.

If you think it's false, you're going to put your thumbs down like this, okay.

So let's start off.

The colour of this card is black.

So I'm going to thumbs like this.

So if three, two, one, it is true.

Okay.

That's right.

So you can see the card that has got those black symbols on it, I'm not going to tell you what shooter this yet, cause I'm get the game away from my next question, but you can see it is black, therefore that statement is true.

Okay.

So next one then.

The suit that this card is hot.

Okay.

So remember thumbs up or thumbs sideways.

If you think it's true, you're going to put your thumbs up.

If you think is false, you going to put your thumbs down.

Okay.

So the suit that this card is hearts so, three, two, one, false.

Okay.

It's not hearts.

They are spades clearly.

So that was false.

So the next one then slightly trickier.

Now this is a tricky one.

The value of this card is greater than five.

So just think about that for a moment.

Okay.

So thumbs up again or sideways and then three, two, one, it's false.

Okay.

Why is it false? Because it is five.

So the value of this card is not great than five, it's equal to five, so it's neither greater than, or less than five.

It's the same as it's equal to.

Okay.

Now all of the things we did that were expressions.

So there we go, conditions and expressions.

So what you did there is you evaluated an expression to true or false, and then perform the action depending on the outcome.

Now that's a very common programme in term called selection.

So a selection statement and programming allows the computer to evaluate an expression to TRUE or FALSE, and then perform an action depending on the outcome.

So if you look at the example on the left hand side there, it says, if the card is true, put your thumbs up Else, which is a programme term for which pretty much means otherwise, then thumbs down.

So expression, that is the card is a heart.

So if the cause of heart, that's our expression and that's an expression, we can decide if it's true or false.

So that's something that we can use in programming, and like I say, it's called a selection statement.

And you'll notice a tense if there.

So sometimes it's called an IF statement and you might've heard of that before.

So an if statement takes an expression and it evaluates it as either being true or false, and then carries out an action depending on whether or not it's true or false.

Okay.

So let's put that into practise and have a game of guess who now, if you play guess who before, you'll notice you often ask very you often ask questions that have a true or false outcome.

So is the character wearing a hat, For example, that would be a normal thing that you can evaluate or do they have yellow hair? Are they a boy? Are they a girl? All of these are questions, that have a true or false outcome.

So let's have a go at this ourself.

So I've got my guest who characters here and the expression that is if the character has a heart, if it's true, remove from the game, otherwise keeping in the game.

So I'd like to just look at my characters for a second and decide which ones are going to be removed from the game.

So remember if the character has a hat is true.

So if it does evaluate the true, it's going to remove the people with a heart from the game.

So let's have a look.

Who's going to go, Oh, there's a red, hat person got into baseball and the green hat.

Okay.

So all the people with the hat went, otherwise they were kept in the game.

Okay.

So that's how it goes with the next one then.

Now I've tried to put the expression in a scratch kind of format.

So to get you familiar with what this might look like when we have a go at doing this inside a scratch now, some of those blocks aren't real blocks.

So the IF in the ELSE and the green flag, that definitely real blocks the, the green characters.

So the expression, the characters, male, that is not an actual scratch block, but it gives you an idea of what it might look like and then removed from the game, keeping the game again, they're not scratched blocks, but it gives you a feel to what the action would be if it evaluates to true or false.

So the next one, then when the green flag is clicked, if the character is male, then removed from game, otherwise keep in the game.

Okay.

So have a look at that statement.

Who's going to go.

I think it should be my judo player who goes, yep.

Bye bye.

Judo player.

Okay.

So we've left with two characters now.

So who's going to be, the person we were trying to guess.

So last one.

When the green flag is clicked, if the character has green hair, then keep in the game.

So what do you think is going to happen? Well, actually, nothing happens in this situation because the character has green hair, then keeping the game while non-fire characters have green hair.

I remember right back to lesson one.

We remember that computers will not make assumptions like perhaps humans might make assumptions.

If we were reading this as humans, if the character has green hair keeping the game, you might not rethink well, otherwise, if they haven't got green hair, let's remove them.

We've not told the computer to do that.

All it's going to do, if the character of green has is going to keep them in the game, otherwise it's going to do nothing.

It's not going to do anything with those two characters in the game.

So they also remain in my game.

So actually I was checking you that it wasn't the last one, this is the last one.

So when the green flag is clicked at the character has a sword then removed from the game, otherwise keep in the game.

So what do you think is going to happen? Okay.

And then three, two, one.

And there was my sole player who got removed.

And therefore I have my winner, which is the girl with the tennis player.

Okay.

So she's one of my game, which is brilliant.

Excellent.

So what we learnt there is about, we've only quite a few things we've learned about expressions, we've learned that they are evaluated to true or false, Okay.

So I've got a question for you to think about, if you look at that block there.

Okay.

When green flag has collected, the character has a saw the move from the game else, keeping the game, look at the statement that I have there.

If the IF and the ELSE are both always executed.

Is that true? Or is it false? So we can just pause the video for a second and really think about that question.

Okay.

And when you're ready, when you have an answer that on, pause it and we'll talk through the answers.

Okay.

So did you have an answer? So I'm going to go, I'm going to give you the answer again.

In three, two, one, it was false.

The IF and the ELSE, both always executed is false.

The IF or the ELSE is executed, not both.

And this is kind of different to the sequence that we've seen so far in lesson one and two, we looked at things being carried out in order.

Now, selection, maybe doesn't do that in order what it does.

It gives you an either or situation.

So if the green the character has a sword, then if it's true, it will remove the game.

Otherwise it will keep in the game.

So if the statement evaluates to false, then they keep in the game.

So the key point here is that both a not executed, only one of them is executed.

Okay.

So our next exercise involves us working a little bit more with Big Ed.

So if you missed him from last lesson, then don't worry, when look, you get to talk a little bit more to Big Ed.

So your next task is to open up your worksheets and complete task one.

Our task one, involves you predicting what you think this code is going to do.

So you're given a programme to, open, have a look at, spend a bit of time just reading the code and predicting what you think is going to happen.

And then what I'd like to do is run the code and then compare what actually happened to what you thought was going to to happen.

And note down anything that maybe surprised you, or maybe something that you missed out that happened, that you weren't expecting.

And it was really easy to be a little bit overwhelmed by the amount of code that you might see on the screen here, but try not to be because actually all this is doing is building on some of the concepts that we've learned in our first two lessons.

So take your time, start off with the first bit of code, which is when the green flag is clicked and then work your way down from there, and you should be able to get a good idea of what you think is going to happen.

Okay.

So I'd like to open the worksheet, pause the video now, complete task one.

And when you've done that, you're ready to continue with the video.

So good luck.

Okay.

So how did you get on with that? Now remember, it really didn't matter if you didn't get it right.

The important thing is you kind of, [Indistinct]now try and get an understanding of exactly how the code works.

Okay.

So that's where our investigates that comes in.

So in a second, you're going to go back to your worksheet and have a go at all the questions that are involved in task two.

So the point of the in-basket step is first to look at certain parts of the code and a little bit more detail and try and work out exactly how they're working.

And that will give you a broader understanding of how the whole programme kind of fits together.

And again, it really doesn't matter if you get it wrong, just try and spend a little bit of time thinking about it, note down what you think is happening.

And when you finished that activity, we're going to go through the answers.

So again, you can just take your time on this and do your best.

Okay? So again, I'd like to pause the video, go to your task two the investigator steps.

And when you finish that, you can unpause and we'll have a look at it in a bit more detail.

Okay.

So let's go through the answers to your investigate questions now.

So the first question was, what is the purpose of the following three blocks of code? Now, hopefully these are starting to become a little bit familiar to you now because we've used them in our previous two lessons, but they are three sub routines in specified in a specific sequence.

So the "Us" name, how are you in birthdate? They call us, they call us up routines.

So they do them in the order in which you specify.

Okay.

Question number two, explain what the following block of code does.

So if health equals yes, then say then good blood have two seconds.

So the answer is if the data linked to the variable health and evaluates as true, so if you remember there was a questionnaire saying, how are you? And the answer to that were stored in the variable health.

So if they then responded with yes, so that means that statement will evaluates as true, it will say good glad to hear it for two seconds.

Now, if the users, that's only if the users responded yes to the question.

Okay.

So I like to then think about the next question was what happens if you say no, when asked to, "Are you okay?" Well, the answer is Big Ed will say, "I have another question for you." because in this "If" statement, there was no Else condition here.

So if this statement evaluates is true, it would say glad to hear it.

If it evaluates to false, then there was no Else there.

So it would just carry on with the sequence as normal.

It's worth noting that the final line is not the Else.

Unless you see an Else, unless it's actually written in there, there was no alternative.

There's no false there.

It will just carry on with the sequence.

So what happens here if you say "No," when asked to, is it your birthday and what happens if you say yes, when you're asked, "Is it your birthday?" Well, if you answered "No" to that, it will say "A very happy unbirthday to you." And if you said yes to that, it will say "Happy birthday," because in this instance, we do have that Else.

So birthday evaluates to true, then it will be, it'll say, "Happy birthday," otherwise, our Else it means it's false.

Which means that birthday hasn't evaluated to true.

It'll say "A very happy unbirthday to you." Okay.

So again, just to hammer home a point, is the Else is not always executed.

As we talked about that before, but it's only true one or the other in this instance.

So as we discovered that in if block allows us to check a condition and perform an operation if the condition evaluates to "true," if the condition evaluates to "false," the operation will not be carried out.

Because this is only a single if block.

There's no Else there.

So let's look at one that does have the Else.

So if an "if" block with an Else, that allows us to perform a different operation should the condition evaluate to "false" before the programme continues.

So going back to this one, that's just a single if statement.

So the if looking at expression that will evaluate to "true" or "false," if it's "true," it will carry out a block of code underneath it.

So if it's true, I hopefully get my pointer.

If it true, it will carry out a sequence wherever blocks are placed with inside this section of the code.

Okay.

But if it evaluates to "false," there's no Else there, so it will continue without sequence of code.

Yeah.

We go to the next slide here.

If the condition evaluates to "true," it will carry out these blocks or cut this blocks of code.

If it's "false," it will carry out these ones and whether or not it's true or false, once it's done either that one or that one, it will then carry on with the rest of the sequence underneath.

Okay.

So hopefully that makes sense.

So the next question, what is the difference between the two following blocks of code? So they're really similar, but hopefully you've noticed that one of them is just a single "if" block and one of them has the Else.

So a way to express the difference between them, Is if block one.

So this block here, okay.

If that block evaluates to "false," then it will say, "Have a nice day." So the weather is not warm and it evaluates to "false." It will say "Have a nice day." So it won't do that.

Whereas this one, if this one evaluates to "false" the weather is not warm.

It will, first of all, it will do this and then it will do that one.

So it will say, "Put your coat on" and "Have a nice day." Whereas this one, because there was no "false" option, it would just move on with the rest of the sequence, which is to say "Have a nice day." Okay.

So the last few questions.

So from which menu on the left hand side of the screen, would you find the if blocks? And remember scratch is really great cause there has some colours that match up with the block colours represent, you know, represented here.

So we could see an if block was an orange kind of colour.

So it's actually a control block.

And the next one, from which to the left, from the menu on left hand side of the screen, would you find the following blocks? And it was the operators and notices that the operators were all green.

So it comes from the green blocks.

Okay.

Now what I'd like to do now, if I've added anything to what you answered, or maybe you've got something wrong, then just spend a couple of minutes just reviewing your answers and maybe fill in the ones that you got incorrect or the ones that maybe you got correct and you think I've added a bit to your explanations or you want to just add a little bit more on a bit of clarity than just spend a couple of minutes doing that.

And when you're ready, you can unpause the video and we'll move on to the modify steps.

Okay.

So, the last thing for us to do with our worksheets is to have a go at the modified tasks.

So I'd like to go through your task three on your worksheet.

And I think there were three things for you to do that.

So how'd it go with those three things and then again, just do your best, follow the instructions, and that involves you modifying the code that's already been provided for you.

So you're going to add to the programme and add a little bit more code to it.

So have a go at those instructions and then once you finish up or if you feel like you're struggling too much and you can't carry on, then unpause the video and we'll go through how to do some of that.

Okay, so good luck with that.

Do your best and I'll see you soon.

Okay.

So we're going to go through the answers to the modified step now.

Now, if you completed a thing, then it's worth watching this to make sure that you did it correctly.

I might be able to explain some things that maybe you were unsure about, but also if you're struggling with it, it's no problem whatsoever.

If you just watch this video and then maybe you could watch how I did it.

And then maybe you might want to go back to your programme and implement the things that you've just watched me do.

So the first task was the part.

So in is adding some hidden functionality that you might come across maybe by mistake in a programme.

So what we asked you to do was to go to the "us" names of routine and then add that into there.

So if the user answers with Ed, so it's not just going to say "hello" then their name, if they answer Ed is also going to say "That's an awesome name," but then also say, "Hello Ed." Okay.

Whereas normally I would just say "Hello name." Whereas we're going to add that little bit of extra functionality if they've got the same name as Big Ed basically.

Now I'm not sure what they've used, discovered this already, but on our window here where we preview our programme, we can make it a little bit smaller by clicking this button here.

Okay.

Now, so we can toggle between making it big and a bit smaller, but if we make a smaller funnel that just gives us a little bit more space to work with when we're playing around.

And I think code with, adding blocks of code to our programme.

So I was going to move this out the way.

So I've got a bit more space.

There we go.

Right.

So to do this, I need to put in an if statement.

So if you look at some of the other if statements that we can see here, we've got one there, so our selection statements, we've got an if in the Else here.

So we know the colour.

And we know from our investigates that's the part of our control options.

So we'll click on control and we'll select an if.

Now we really need to think about where we want to put it.

We want it to appear before we say "hello name," but after the name of set, obviously, so it has to be in here.

Now, is it can be a bit tricky slot in, but you're just going to get it right.

You'll see that that purple block moves down, which is what you want, so I can click that and it will show it.

Alternatively if you really struggle with that kind of thing, and it's just been a bit fiddly, then you can just drag that block out the way, then put this one in.

A bit like you construct in Lego blocks and then put that out there.

And we got an new statement to work with.

So we want our expression to appear in here.

So we want to say if their name is equal to Ed, okay, so let's go for operators and that's the equals that we need.

So we've got here, and you can see the shape of this, of this block here fits nicely inside our selection of statement inside our if statements.

So that's our condition.

So I'm going to put that in there, our expression, sorry.

So I'm going to say if name is equal to Ed, so I'm just going to type in Ed, but also what name and here.

Now, if I type in name, it would just mean it's a string names is in the words the letters name equal to Ed, which it isn't.

We want the variable name.

So you can see that it's kind of like orangy colour there and the circular colour, circular shape.

Sorry.

So click on variables, there you can see I've got a list of the variables being in use in my programme so I can click on name and drag it and you'll see again, it's the right shape for this block here.

Okay.

So if name is equal to Ed, then I can put in my saved blocks and that's purple.

So that's purple as well.

So I'm going to go to looks, and I'm going to write in the requirements, which was, "that's an awesome name." Okay.

So that's Oh, can't spell that.

Oh, there we go.

"That's an AWSOME name." Cool.

So it was really important now I think, I think I've met that task, but it's really important that we test it.

Okay? Because it may well be that it hasn't worked.

And we don't know until we run through our programme and have a go with that.

So I'm going to make a little bit bigger.

And then when my programme, I says, "Hello," they get from the year 2182, it could say, "What is your name?" And I'm going to test it out by typing in Ed, and hopefully that should say, "That's an awesome name" and say, "hello Ed." Okay.

So that's what I think is going to happen.

So here enter, that's an awesome name.

"Hello Ed." Perfect.

Okay.

Now that's only part of my task because I really should run it with a name that isn't ed a less awesome name.

So I'm going to prospect my name then, which is still let's face it.

An awesome name does not quite as awesome as that.

So it's not going to say "That's an awesome name", even though it is, instead, it should just say hello, "Ben".

That's how I look.

Perfect.

Great.

Okay.

So that's working.

So I've stopped my programme.

So move on to my next task, which is part two.

And that was what if I'm not okay.

So that required us to go to aah, the how are you subroutine, now this time, if you notice how it works so far, it says, "Are you okay if the", and it's going to take the answer and set the variable health to the answer.

So it's then going to look at my expression here.

So if health is equal to yes, if that's true, then it's going to say "Good clubs to it", but there's no, otherwise it's just going to say, "I've got another question".

So if the answer as we discussed before, if they put in, yes, I can say "Glad to hear it".

And then it's going to say, "I have another question".

If you put a, no, it will just say, "I have another question".

So what we'll ask him for here.

If they do enter a "No", then it'll say, "Oh no, I hope you feel better soon".

Now there's two ways in which you could have tackled this.

So let me go through the way in which I think a lot of you might have tackled it, which is to get, not get rid of this, but let's move this other way and put in an IF and an ELSE.

Okay.

So I'm going to put an IF and an ElSE there and am going to keep this related, by the way, and just, I'm going to drag that out of there.

Oh, no, not that I want the whole green blocks.

I'm going to make sure I don't just let the health.

Yeah, there we go.

I'm going to put that in there and then I can say, "Good, glad to hear it".

And then I'm going to I'm showing you yes, but this is quite an a night, a nice little trick.

You can right.

Click over one of these blocks that you want to copy and you click duplicate.

It makes an exact copy of that block, which is perfect.

Saving them to go to this menu and find it, and then stop that from running.

And then I can change the message.

So I wanted it to say, "Oh, no, hope you feel better soon".

And then slot that in there.

Okay.

So that should work.

So if I type in, No, that means that that one evaluates to false, therefore the Elsa will be activated.

So let's just run that through.

So it's going to say, "Are you okay?" So it's going to look through the first sub routine first, which was off names.

So I just run through that can say, "Ed, are you okay?" And if I type in, No, it's going to say, no, hope you feel better soon".

And then say, "I have another question for you".

Yeah, it works perfect.

Now here's the, thing that might've made you think a little bit harder about it and thought, how are you going to do it? Because we have a slight problem with the way this is coded, and this isn't on the requirements of the task, but I'll show you anyway.

So I'm going to type in my name, Ben, but this time I'm going to think of a different response that isn't "Yes" or "No." "So are you okay?" I'm just going to put, "yup".

Which somebody you want to answer, I'm going to enter.

And what's going to happen when I put yup? Is it going to say "Good glad to hear it?" Or is it going to say, "Oh no.

Hope you feel better soon".

It's going to say, "Oh, no.

Hope you feel better soon".

Which is not what I wanted really, because I'm actually essentially answering.

Yes.

So our way to get round that basically what's happening is I've put in something that's not.

Yes.

And it's assumed the answer is negative and that's maybe not what I want.

So what we'll do is I'm just going to pop my IF block back inside there.

Okay.

And shove that in there.

Now I'm also going to put in the IF underneath this.

So I'm just going to put that back in there.

Now this time I want to duplicate this.

So I'm going to duplicate it and say "If health equals No" stop it from running.

So I've got tariff statements here.

I've said if, they've answered.

Yes.

So good glad to hear it.

I'm asking another question.

"If health is equal to no".

Then if that evaluates to true and say, "Oh, no, hope you feel better soon".

But if that's all that is, aren't true, then I've got another ElSE here.

Why don't you keep that? And maybe you say, well, it down to wasn't.

Yes or no.

I'm just going to say, I didn't quite understand what they said.

So I'm just going to say, "I didn't understand that", okay, so this way, now, if I put something other than yes or no, hopefully it will go.

I didn't understand that.

But again, it's really important that we test that out so we know yes.

Works.

We know no works.

So if I try something a little bit different, it's not hopefully going to answer yes or no.

"Are you okay?" I'm going to put, "yup".

So this isn't, that means hopefully than theory, this works health eat.

It's not equal to, yes.

That's going to be a value.

It's a false.

So it's not going to, it's going to move on to the next sequence is healthy equal to no?.

it's going to evaluate to false again, but this time we'll have an ELSE in there.

So it knows what to do when it gets to false.

So if it's false, it's going to then execute that block of code.

I didn't understand that.

And then I have another question for you.

So let's just see fingers crossed.

That works.

Yup.

And there we go.

"I didn't understand that.

And I have another question for you".

Perfect.

So there we go.

So, like I say, there's more than one way in which you could have tackled that.

The first way wasn't wrong.

It was, it was fun.

It's just that you can see why I've added the extra bit on that to maybe think a little bit more about how the user might have responded.

Okay.

So the third and final task of our modify step was to go back to a us name.

And this time we're going to add a little bit more to our expression.

So our expression is name equals that, but what was, as they say, Big Ed.

Now the answer in Big Ed at the moment and felt let's just test it out.

So it says, "hello, I'm Big Ed".

And I'm just going to type in Big Ed.

See what happens so Big Ed.

Now, Big Ed is not the same that, okay.

So hopefully not going to say that's an awesome name because that's, condition's going to evaluate to false.

And therefore it's going to continue with this sequence, which is say "Hello".

So let's have a look.

Yeah.

"Hello, Big Ed".

Perfect.

So it didn't actually work as it worked.

I was like expected, but it didn't do what I wanted.

I wanted it to actually, if it says, "If name equals ad or name equals Big Ed, then say that's an awesome name".

Right.

So what I need to do in this instance is go back to my operators and look for that all block.

So half on here.

So I'm just going to shut that down here so you can see it.

Now I'm going to take this expression out.

I'm going to duplicate it.

Okay.

So right.

Click duplicate.

And I've got two of them.

Perfect.

So click that.

I'm going to shove this one in the left hand side.

Can you see the way.

Let's up slightly? So show me when it's ready to put it in.

So I'll put that there.

And then I'm also going to put this one here.

Now they're the same thing at the moment going to edit it.

So at the moment we're saying if name is equal to Big Ed or name is it.

Sorry I said that wrong, if name is equal to Ed or name is equal to Big Ed.

This means it's going to allow either or so long as one of those is "true." Then it's going to say that's an awesome name.

So I'll just pop that in there.

Try one more time.

And now hopefully you it work without that, and I typed in Big Ed in it and just said, "Hello Big Ed," rather than "That's an awesome name." So let's test that out now I've added this block of code.

So I'm going to knock and type in Big Ed, if all is well with the world I hit enter, It should say "That's an awesome name." And then hello, Big Ed.

Hey, perfect.

Okay.

So that's all of my modified tasks.

So again, remember if you struggle with some parts of that, you might want to just go back to your code and have a go at putting that in yourself and just build yourself a little bit of confidence in doing that.

Okay.

So for the final task for this lesson, is to complete a Parson's problem.

Now Parson's problem is to take some jumbled up lines of code and then put them in the right order to form a working segment of code.

Okay? So this task is for a quiz question.

And the quiz question is going to ask you, what is the capital city of Spain? Now what I'd like to do is read out to the code so ask the question and if they get it right.

So for example, if they, if they answer "Madrid," it adds one to the score otherwise I'd like it say incorrect.

So go to your task sheet where you find the link.

So if you click on that link, it'll take you to a scratch programmes, select see inside, you'll see some jumbled up code, so you can reorder the code to make that programme.

And then when you've done that, if you restart the video and then we'll finish off today's lesson, I'll show you how I show you what the answer was.

Okay.

So how did you get some with that? So hopefully you came up with a working segment of code, but if not, we're going to go through the answers now anyway and if you think you've got it right, , cause you might have maybe done something a little bit wrong, or you might learn something from what I'm about to say.

So we started with these jumbled up blocks of codes.

Hopefully you knew that to start off with, we needed the when the green flag has collected.

So that's what I want to do that.

Okay.

So we also have this sub-routine here.

So all I want to happen is when the green flag is clicked is that I'd like maybe question one sub-routine to be called.

So what I now need to do is make sure I define what the question wants sub-routine is.

Okay.

So the first thing I want to do is ask them what is the capital city of Spain? Right? So that's my first question I'm going to ask.

And then I want to hopefully set the answer.

So set capital city of Spain.

So that means a variable has been set up for me.

So whatever the answer I'm going to set the capital city of Spain to answer.

Okay, so now I have a variable, that's got their answer stored.

So I need, my next part was going to have my if statements.

So if the capital set your Spain equals Madrid.

So let's slot that in there.

If it did, I'm going to say, yeah, that's correct only without the "yea" bit, but that's correct.

And I'm going to add once their score, but if they're wrong, it's going to say, say incorrect for two seconds.

Now I've got a spare block of code here, saying, say set, score to zero.

So where am I going to put that? Now, let's think about where I'm going to put that.

I'm going to run this code and you'll see, hopefully I can show this variable, so you can show a variable.

It's not currently show, but in public school, they all appear on the side of the screen there.

So I've ticked it.

So it shows it there.

But if I run this programme without slotting, that block and that see what happens.

So what's capital city of Spain? I'm going to put a Madrid.

Yeah, that's correct.

And it's going to give me one for my score.

Perfect.

And then the game is finished, but let's start again now.

What's the Capital city, Madrid I've already started with one point and because I've got it correct again, it's going to put one more to my score.

So my score is now two, which is not what I want.

So when do I want to set the score to zero? I can't do it when it's incorrect cause that wouldn't change cause I entered a Madrid twice.

I like, I just did that.

My score would be two and I've never been incorrect.

So my score would never go down to zero.

So we actually want this, the score block, is that I'd like it right at the beginning.

So as soon as anybody starts a new game, no matter what the previous body of score was, let's set it to zero right at the beginning.

So now if I click the green flag, you should see score, go back down to zero and it does enough for type in Madrid.

It goes like, they're going to say that's correct.

And again, don't forget to test this out.

I'm going to say it's Barcelona.

It's not Barcelona clearly.

So that should say "incorrect." And the score shouldn't change the one.

Perfect.

There we go.

Okay.

So that's it for this lesson and I really hope you've enjoyed it.

And I hope you enjoyed chatting a little bit more with Big Ed.

So if you'd like to share some of your work with us, that'd be really great.

So if you can, if you'd like to share maybe a video or screenshot of some of your work, then if you ask your parents or carer to share your work on Instagram, Facebook or Twitter, tagging @Oakational and hashtag learn with Oak.

So I hope you enjoy the learning for the rest of your day.

And if you'd like to write down three key facts that you learned from today's lesson to help you remember what we did learn rather than that, I'm really looking forward to seeing you next lesson.