While loop and async function

How could I do that. I’m just using a custom plugin that performe some functions and return a string. I need to check this string and use an if to check if the result is correct or not, and then call again the plugin. I’m looking for a while but promise is the only way I found, nothing more about sync check and launch of the plugin. Could yo suggest any other way?