Prompt should not close until user make entry and click on OK

Powershell My requirement is prompt should not close until user make entry and click on OK . Or if user click on Cancel then again prompts for entry.

Screenshot 2022-11-11 105853

[void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
    
 $title = 'Demographics'
 $msg   = 'Enter your demographics:'
    
 $text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
    
 Write-Host $text

Hi, welcome to the forum :wave:

while (-not $text) {

    [void][Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic')
        
    $title = 'Demographics'
    $msg   = 'Enter your demographics:'
        
    $text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
        
    Write-Host $text

}