In this lecture, we will learn about writing statements so a statement can be declared of a variable,
an expression that evaluates to value, or it can a definition of a type.
So a statement may also be control structure to affect the flow of the execution toward your code.
So a statement ends with a semicolon here.
Other than that, there are a few rules about how to format statements, so you can even use a semicolon
on its own.
And this is called a new statement.
So a new statement does nothing here.
So you can see here.
So having too many semicolons is usually banning.
So let's write an expression example expression for it.
So an expression is a sequence of operators and operations variable or literals, so that result in
some value.
So for example, let's write some statements here.
For example, Integer E semicolon, we created integer integer type variable and let's equals six multiply
by seven.
And as always, this is the comment answer is 69.
No.
42.
So here on the right side, this is an expression.
And the assignment here, this is the assignment from E to the left side to the semicolon.
On the right is a statement.
So every expression is either a value or an R value.
So you are most likely to see these keywords used in other descriptions.
So in effect, the the l value is an expression that refers to some memory location.
So items on the left side, items on the left hand side of an assignment must be l values.
So however an l value can appear on the left or right hand side of an assignment.
So all variables are l values.
So and our value here are value is a temporary item that does not exist longer than the expression that
uses it.
So it will have a value but cannot have a value assigned to it.
So it can only exist on the right hand side of an assignment.
So literals are our values.
So for example, literals fleet URLs are are values.
So.
So let's let's go over here.
As you can see, this is the this is the clearest example of the error values and L values here.
So as you can see here in the this in second line, in the 10th line, in this line e here is an l value
and expression six multiplied by seven results in our values.
So for X actually let me write in here E is an L value is E is.
Is el value.
And six multiply by seven is our value.
This is our value because of it exists in memory only once.
So.
And we are signing our value to value here.
So.
This is on a value here, as you can see here.
But if so, actually let me print this functions here.
F d actually, let's use C out here.
C out.
STD C out.
Here is the d.
C out.
E and end Lyme and STD and Lyme.
Listed the headline.
Yeah, let's compile this.
And as you can see, we got the 42 values of return, default 42 as values.
So let's try following example here.
For example six.
Let's, let's first write six.
Multiply by one and then assign it to E.
So six.
Multiply by one is 6.7 and equals E.
So as you can see, we got an error because we cannot assign a value to our value here.
So as you can see here, we got an error failed.
Let's see, what is the error?
What is our error?
As you can see here.
When we do this, we get an error like l value required as left operand of assignment.
So C++ compiler tells us why we got an error.
So I'm going to I'm going to comment this.
So we will do more examples about it.
And I don't want to get confused by this errors.
So then I'm commenting this line because now it's not a code anymore, it's just a command.
So when we run this, we got the way our program is working again, so let's copy this and error here.
And we got we will write the word error on the common side.
So if we want to try this in your computer, you can delete this code and.
Make sure so you can delete this code and run this program and compile.
As you can see here, we got the same error value required as left apparent of assignment.
So I hope I hope this is pretty understandable here.
So brother speaking, an expression becomes a statement by when you append a semicolon.
So for example, let's try the following example.
42, just 42 and semicolon and STD asked here to.
As you can see here, we need to add add our import function security, as you can see here.
Seemed complex.
And so I think it's a simple math.
As you can see here.
We added our C math library into our C program, and when we come around this application, it it has
the same output because we didn't we didn't print anything on the screen.
So as you can see, we got just an only print function here that prints E and nothing else.
So this is the.
The first line is here.
The first line is an R value of 42.
But science is temporary.
It has no effect, so a C++ compiler will optimize it way.
So the second line here, as you can see here, the second line calls the standard library function
to calculate a square root of two.
Actually, let me write it here.
Root of two.
So again, the result is an R value and the value is not used.
So the compiler will optimize this way.
However, it illustrates that the function can be called without using its return value.
Although that is not the case with the SDD squared here.
So many functions have a lasting effect other than the return value.
Indeed, the whole point of a function is usually to do something and return value is often used merely
to indicate if the function was successful.
So often, often, developers assume that the function will succeed and ignore the return value.
Actually here we got to learn about our values and our values.
So you can test these statements and codes in your own computer, actually.
So that's it.
As this lecture and the next lecture, we're going to learn the comma.
Operator So I'm waiting you in the next lecture.