Hello.
In this lecture you will learn about the cplusplus writing techniques and language features.
So Cplusplus is a very flexible language when it comes to formatting and writing code.
So it's also a strong type language.
So meaning that there are rules, but clearing the types of variables which you can use to your advantage
by making the compiler help you write better code.
In this section we will cover how to format Cplusplus code and the rules on declaring and scoping variables.
In this lecture we are going to start with the white spaces.
How you can use white spaces in cplusplus.
So here, other than string literals in white spaces, you have free usage of white spaces.
So you can as long as as many as you can use as many as tabs, spaces, uh, spaces, spaces and new
lines.
New lines.
As you can see here.
You won't get you won't you will not get any error because of it.
Here, as you can see, you can use as long as many as new lines, tabs and spaces you want here.
As you can see.
Let's compile it.
As you can see, C plus plus compiler doesn't care about them.
So.
So about C plus plus statements are eliminated by semicolons here, as you can see here.
So let's create an example code.
So to explain it better.
So for example, let's create an integer variable, assign it four and integer equals integer derived
by two.
So we will get two from it.
And let's print F print f this.
As you can see here, we get we got an error because in print F so we have to use the print we have
to use in include library, you will learn about how to include library and what library is in later
lectures.
But it's not a hard thing to learn, but you will learn in next lectures include here.
Um.
STD dot h here.
As you can see, we got rid of this error here.
Return.
Uh, let's return zero from it.
Integer function.
As you can see here, this function returns zero.
You will learn.
And then here, as you can see, we got the format.
Um, then.
And let's print something on it.
So as you can see, if you if you delete this, include statement, this we will get an error here,
as you can see here.
And.
Yeah.
Let's include our statement here and delete this common line.
Clear And yeah.
So let's print these values on it.
Actually, let's, let's use the C out we will use.
We will we will use the printf later in this course.
So as you can see, we got an error from it.
Let me write this code.
The result result is we will pass E as you can see, we will pass E and then end line here.
End line.
So as you can see, we've got an error.
So if you include the stream.
Yeah, you will get rid of that error.
That's because the STD library needs input output stream here, so.
And and as you can see, if we delete the printer function so we are not using print function anymore.
We don't need this library.
And as you can see here, see line ID, this blue, just the gray, gray color, this text for it.
And then here.
As you can see here, we have a new line here.
Um.
Every between our line and let's run and compile our program.
And we got a result here.
The result is two.
So let's try one example here.
Just delete these new lines.
Yes.
Just let these new lines and let's try if this works here or this.
Here.
We need these two semicolons and we do this too.
So you can put spaces on new lines between variable names or functions or whatever you want here and
you can use here.
As you can see, we got the same result.
So there are some cases white Spaces is needed.
For example, when declaring a variable, you must have a white space between the type and the variable
name.
So but the convention is to be judicious as possible to make the code readable.
And while it's perfectly correct language wise to put all the statements in one line like a JavaScript,
but it makes the code almost completely unreadable.
So of course it's less readable than the previous, uh, previous codes here, as you can see here,
let me here, this is more readable, right?
So actually, let's, um.
Let's correct let's note this because I'm uploading this files to every lectures, and you can download
and use these codes by letter.
So for example, correct by language wise, but readable and readable and readable.
And let's collect let's write another code here.
For example, let's so as you can, as you know, we can create a two variables at the same name.
So I'm going to change these names here.
Uh, so.
Of course you can print the as long as you want, but you just can't create the same name, same name,
variable, same named variable.
So as you can see here, this is here.
Here.
This is correct.
Correct.
By language wise.
All right, let's just create a program will compile.
Without problem but unreadable.
So I will explain why we need this.
Readable and unreadable codes here now.
So.
Being in mind that if the code write code you write is viable, it may use.
It may in use for decades, which means you may have to come back to code years after you've written
it.
And it means that other people will support your code too.
So making your code readable is not only a courtesy to other developers, but unreadable code is always
a likely target for replacement here, as you can see here.
Of course, it's more readable than this, so.
In this lecture.
In next lecture, you will learn about the formatting, the code in C plus plus.
So see you in the next lecture.