From variable to variable
In programming, it's often useful to assign the value of one variable to another variable. This allows you to create multiple references to the same value, which can be helpful in a variety of contexts.
To assign the value of one variable to another, you simply use the assignment operator =
followed by the variable you want to assign the value to. For example, let's say you have a variable x
and you want to create a variable y
with the value of the x
variable:
Loading Code . . .
Now, both x and y have the value of 5
.
If you change the value of x
later, y will still hold the original value of 5
, because it's a separate variable.
Loading Code . . .
Now answer the question:
What is the value of y
in the following code?
Loading Code . . .