In another post you said that you are studying basic point set topology.

But I will answer this question for metric spaces.

Basically we replace the open interval with open balls .

In other words, there is a natural extension of the definition.

As we move into abstract topological spaces, we replace open balls with open sets.

I hope this very simplified outline gives you some guidance.