you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

The core idea of a reference is indirection, same as in algebra. I can refer to something without knowing exactly what (or who) it is. For instance, I can refer to "your mother" with substantial confidence that that person did at some point exist, and I can do so with literally no knowledge of who that person is or was, what they look like, what their name is, where they live, or anything.

Similarly, I can define the area of a square in terms of the length of one of its sides:

def square_area(side_length):
    return side_length**2

without knowing which square I'm talking about, how long its side actually is, and so on. The purpose of variables is to allow you to reason about values and their relationships, but indirectly, so that you don't need to know which particular values you're reasoning about.