 Hello world it's the Serving Scratcher here bringing you another video connecting the world of maths, Scratch. You haven't already checked the description below for links to previous videos as this one is part of a series. In this video we're going to take our plan that we created in the previous video and we're going to translate those English sentences into Scratch code blocks. So let's get stuck into it. Okay so here we are back in our Scratch project for now. I'm inside the card sprite and I'm back at our custom block here calculating our integer to move. What I'm going to do now is just move the Scratch project along to the side just to have it side by side our planner project just so it can make it nice and clear to see what we need to do. Okay so let's just start at the top. We know that our imaginary up here is calculating our number of integers to move. So this would be our first line of code that we need to actually code. So if the variable operation is the addition or positive sign. So really nice if we're using words like if we know that there are control statements in there and there's definitely an if statement that we can use. So if the variable operation, well let's go get that variable operations around here somewhere is equal to or is the addition sign. So that's going to be an operator. We need an operator. So let's get the equal, the comparison operator and we'll stick our operation in there. So if the variable operation is the addition sign or the positive sign there and you'll see that this puzzle piece, this operator statement fits nicely into a statement. So now we have just done that top line of code. If the variable operation is the positive sign then we want to set the variable number of integers to move. So that's a variable. That's pretty easy to go and get. That's set block. That's just not setting the balloon to move. We're setting the numbers of integers to move to the variable integer. Okay well let's go do that. Okay so we've actually accounted for all of the code up the top here for our addition scenarios. Let's now account for our subtraction scenarios. So we need another if statement. Now we could go in and get all these things out of the library again but I'm a coder and I like to do things the easy way and I'm just going to go duplicate that block there because we've already got a lot of the stuff we need. We're repeating the statement, we're repeating the operation. What we're not repeating is the sign. This time we need the subtraction symbol. This time we're also going to be setting the number of integers to move to not just the integer this time. So we need to set it to zero minus the variable. So to be able to do that we're going to jump back into our operators and we're going to look for the one where we have the subtraction operator which is this one just here. So we need to set it to zero minus the variable integer. If we do that we can slot that one straight back up there. Okay so what I'll do now is I'm just going to drag our scratch window back across because we're done with our planner. We've actually plugged in all of our bits and pieces that we need to. I'm just going to increase the side of our view there. So what I'd expect now is when we press this green flag and we start our game and we deal our cards. We're no longer going to get this call out instructing us to work out or put input into this custom block. We would expect whatever result the user inputs now for the bat to actually say the right calculation because it wasn't happening last time. So let's do that. Here we go. We've got a subtraction operation and we're taking away the positive integer five. Okay so currently our player one is at zero we need to take away five. So I would expect us to be at negative five. So over here where this is entering into it's going okay if our operation is positive well no it's negative. So if our operation is negative yep we're inside here we're going to set the number of integers to move to zero minus the integer. So the integer is five, zero minus five is just negative five. Okay so negative five. Correct, great but we still need to program the next part of it. That's cool. We will get to that. Let's just go through another example. We just know that it worked for the subtraction. So let's see if we can get a positive operation. There we go straight off the bat. So now where is our balloon going to end up? Well if our operation is positive and it is great we're going to set the number of integers to move to the integer. Yep so where the integer here is positive six so we're just going to set our answer while we'd expect our balloon to end up at six. So let's go and do that now. And it looks like our balloons are actually moving. It's just the animations and the feedback that we need to actually hook up. Great that's correct. We need to still program that custom block to say the move type for the bat to give feedback and for these animations to happen. So our balloon will move but nothing happens with our animation. Awesome. So I hope that really spelled it out to you how this this code block works based on the result of our operation and integer. That's all for this video. In the next one we need to move on to the next part that we need to fix which is all about saying the type of move that our balloons made and giving you some feedback. If you like this video give it a thumbs up. If you want to stay connected to when I release more content make sure you hit that subscribe button. But until then I'm off to go find a way. Take it easy.