What's this called, a variable.method?

current_node = current_node.get_next()

what is this, in simple terms what am i doing here?

What your assuming is pretty much what your doing, in that current_node is a variable, and get_next() is a method/function on that variable.

The single line you have is:

current_node = current_node.get_next();

Which is executed from the right side of the = and assigning it to the left, so your effectively getting the “next node” and assigning it to current.

What these methods do and return is more up to the implementation of the function though and I assume it functions how its named (it returns the next node), but get_next() could also print hello world and return the value of 15, but given its name it probably doesn’t do that haha.

ok i see, so you’re doing something to that variable and then setting it to that variable again after doing something to it

yes, when your have something of the form:

variable = somethingSomething;

your are executing what’s on the right and assigning to whats on the left in that order. So in the original example you are calling the get_next() method/function and assigning what it returns to the left.

It just so happens what your assigning to (current_node) is whats being used to call on the right, but the same idea and “order” of whats going on is the same :slight_smile: