In the following code snippet next_dot is used in an if statement, why?
def on_mouse_down(pos):
if dots[next_dot].collidepoint(pos):
if next_dot:
lines.append((dots[next_dot - 1].pos, dots[next_dot].pos))
next_dot = next_dot + 1
else:
lines = []
next_dot = 0
I do not understand what "if next_dot:" does and how it contributes to this code.