LHS and RHS stand for Left Hand Side and Right Hand Side of an assignment operation. This allows for us to break down the code and analyze exactly what is happening.
For the first part post, we are going to be analyzing the following program
This program actually breaks the LHS and RHS look ups into two different statements.
The LHS of the assignment operation will look up the variable container and assigns a value to that container. In the program,
var a = 2;
looks for the variable a and assigns it the value of 2, so that categorizes the statement as a LHS look up.
The RHS of the assignment operation will look up a value of a variable. In the program,
looks for the value of
and outputs that value, which in this case is
Now, let’s look at a program that has both a LHS and a RHS look up.
The LHS look up of this program is
. That is because when
is assigned the value 2. The RHS look up in this program is
since the program has to look up the value of
to perform the
If you enjoy my posts, please consider subscribing to my Patreon and checking out my other posts!