Write while loop equivalent in elixir

In real life I can use while(some_condition) for repeating an action unknown number of times. Like:

do {
  name = generate_new_name();
} while(name.exists?)

So I can’t really do any sort of enumeration here. Should I do the recursion in such case? And if I wanted to limit the depth?