Hello.
In this lecture, you will learn about the C++ writing techniques and language features.
So C++ 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 about declaring the types of variables which you can use to your advantage
by making the compiler help you write better code.
In the section we will cover.
Have the format, C++ code and 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 C++.
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, spaces, spaces and new
lines.
New lines.
As you can see, you won't, you will.
You will not get any error because of it.
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++ compiler doesn't care about them, so.
But C++ statements are eliminated by semicolons here, as you can see here.
So let's create an example code so as to explain it better.
So for example, let's build an integer variable.
Assign four and integer equals integer divide by two.
So we will get two from it.
And let's print a print of this.
As you can see here, we get we got an error because in print.
So we have to use the print.
We have to use inclusive library.
You will learn about how to include library and what library is in later lectures.
But it's not our thing to learn.
But you will learn in next.
Lectures include here std that h here.
As you can see, we got rid of this error.
Here return.
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 if we got the format then.
And let's bring something on it.
So as you can see, if you if you read the latest statement this, we will get an error, as you can
see here.
And the.
Yeah.
Let's include our statement here and delete this common line.
Clear.
And yeah, so let's print this values on it.
Actually, let's, let's use the C out.
We will use a.
We will.
We will use the print of later in this course.
So as you can see, we're going to 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 and line.
So as you can see, we've got an error.
So if you include the stream.
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 print a function so we are not using print to function anymore.
We don't need this library.
And as you can see here, see lion ID this blue or just the great gray color, this text for it.
And then here.
As you can see here, we have a new line here.
Ever.
Between a rope line and let's run and compile our program and we got an.
Result here the result is two.
So let's try one example here.
Just let these new lines.
Yes.
Just in these new lines.
And let's write if this works here or this.
Yeah.
Officer.
We need these two semicolons and we do this too.
So you can't put the 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 whitespace 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 unreadable than the previous previous code here, as you can see.
Here, let me here.
This is more readable, right?
So actually, it's.
That's correct.
Let's notice this, because I'm uploading this files to every lectures and you can download and use
this codes by letter.
So for example, correct by language wise, but are readable and readable and readable.
And let's collec let's write another code here.
For example.
Let's.
So as soon as you know, we can create a two variables at the same name.
So I'm going to change these names here.
So.
Of course you can print the E as long as you want, but you just can create the same name.
Same name variable.
Same name Variable.
So as you can see here, this is here.
Yeah.
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 Court right your right is viable, it may use it may in use for decades,
which means you may have to come back to court the years after you've worked it.
And it means that other people will support your court, too.
So making your code readable is not only courtesy to other developers, but readable code is always
likely targets 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++.
So see you in the next lecture.