Continue while from nested for-loop

前端 未结 2 783
遥遥无期
遥遥无期 2021-01-12 23:19

I have the following loop structure:

while ($reader.Read() -eq $true)
{
    $row = @{}
    for ($i = 0; $i -lt $reader.FieldCount; $i++)
    {
        if(som         


        
2条回答
  •  离开以前
    2021-01-13 00:11

    EDIT: a revised, recursive (and untested!) solution so your millage may vary:

    function doReader()
    {
        while ($reader.Read() -eq $true)
        {
            $row = @{}
            for ($i = 0; $i -lt $reader.FieldCount; $i++)
            {
                if(something...)
                {
                    #continue with while
                    doReader
                    break;
                }
            }
        }
    }
    doReader
    #do more stuff
    

提交回复
热议问题