‫Hello and welcome.
‫In this lecture, we're going to be learning about comments, these things in Green and Visual Studio
‫code and how we can use them to write pseudo code to essentially be a note to ourselves on how we want
‫to implement something.
‫Let's dive in and learn about these concepts.
‫So what is pseudocode?
‫Pseudocode?
‫This is the dictionary definition is a plain language description of the steps that we're going to be
‫using in an algorithm.
‫So I want to write a plain language description of what we're planning to do to make this moving platform
‫go backwards and forwards.
‫Now, to do that, I could write out on a piece of paper, but I can actually write it into my code
‫without having to worry about making sure it's correct.
‫C++ and that is the whole point of pseudocode.
‫But to do that, we need to know one more piece of the puzzle, which is what is a comment?
‫A comment is code that is ignored by the compiler.
‫So it's a way of writing into our text file stuff for humans to read that the compiler will then ignore.
‫And we can just use that to write pseudocode.
‫We can use it to write notes to each other as programmers and to clarify what it is we're trying to
‫do in a piece of code.
‫So let's have a look at doing this over in the moving platform.
‫Keep in tick.
‫Now a comment is basically any line that starts with a double forward slash.
‫You can see that in Visual Studio code, this automatically gets coloured in in green and we can see
‫examples of these green lines elsewhere in the C++ file, you can see it says fill out a copyright notice.
‫It says sets default values called well, the game starts or when spawn called every frame.
‫So actually these comments are already helping us understand what's going on in this C++ file.
‫And now we understand that these lines have no particular meaning to the compiler.
‫In fact, as far as the compiler is concerned, one of the first things it does is just remove all comments
‫from the file because it just doesn't need them.
‫It ignores them when it's dealing with them and turning them into binary.
‫So what we want to do is write out a little plan for how we are going to make our platform move backwards
‫and forwards.
‫So the first thing we're going to do is update the location of our platform.
‫So move the platform forwards, so move platform forwards.
‫And how are we going to do that?
‫Well, I'm going to use some indentation to show that this is how we're going to be moving the platform
‫forwards.
‫We're going to get its current location.
‫Then we are going to add a vector to that current location.
‫And that might be a good place for us to use a local variable because we don't want that intermediate
‫result to be remembered at the class level.
‫Then we're going to set that location.
‫But what about sending the platform back?
‫Well, let's have another comment here.
‫Just at the indentation level below, we're going to send platform back if gone too far.
‫So what we're going to have to do there is check how far we've moved, first of all.
‫And if we've gone too far, we're going to reverse the direction of motion.
‫So reverse direction of motion if gone too far.
‫So here we have a very basic pseudocode description of what we're planning to do in the upcoming lectures.
‫Please go ahead and add this to your own C++ file.
‫You can use your own words to describe each step.
‫This is just my interpretation of it.
‫And because this isn't used by the compiler at all, it doesn't matter whether you have a typo or anything
‫like that.
‫The most important thing is that you just start each line with a double forward slash.
‫Okay, I will see you in the next lecture.