How to hold a loop to display a text?

I have function that goes through some million items array and does some calculations before a texture is finally drawn based on that. This takes quite a time and I don’t know how to use a yield statement that would display a progress information (might be text) showing a progress. Any help please?

Coroutines.