do while里面用true,没办法跳出循环,return不好使,求解答


private static int[] UnionLottoArray()
        {
            //获取数据
            do
            {
                Console.WriteLine('\n' + "请输入7注彩票数:(格式:xx,xx,xx,xx)");
                string lotteryNumber = Console.ReadLine();
                string[] segmentation = lotteryNumber.Split(',');
                int[] unionLotto = Array.ConvertAll(segmentation, int.Parse);
                //1.是否输入了7个数
                //2.数字是否都是大于1小于33
                //3.是否有重复值
                if (unionLotto.Length < 7 || unionLotto.Length > 7)
                {
                    Console.WriteLine("输入有误,请重新输入1");
                }
                else
                {
                    for (int i=0;i< unionLotto.Length; i++)
                    {
                        if (unionLotto[i] < 1 || unionLotto[i] > 33)
                        {
                            Console.WriteLine("输入有误,请重新输入2");
                        }
                    }
                }
                for (int i=0; i< unionLotto.Length -1; i++)
                {
                    for (int j=i+1; j< unionLotto.Length; j++)
                    {
                        if (unionLotto[i] == unionLotto[j])
                        {
                            Console.WriteLine("有重复值,请重新输入");
                        }
                        Console.WriteLine(j);
                    }
                  //尝试过在这里加return,但是错误的时候就会跳出 
                }
            } while (true);
        }

请问我这段要怎么写才能跳出循环,备注一下:我这方法里面要三个条件都满足了才能跳出,并且如果有错误的情况就继续执行循环,直到完全成功才跳出。
必须用do while循环,要先获取数据,然后才能判断。用true做条件是因为,获取的数据都循环里面,没办法直接用做条件。
如果要加一个判断做跳出,实在想不到是用什么来做条件,求帮帮忙~


        private static int[] UnionLottoArray()
        {
            //获取数据
            do
            {
                Console.WriteLine('\n' + "请输入7注彩票数:(格式:xx,xx,xx,xx)");
                string lotteryNumber = Console.ReadLine();
                string[] segmentation = lotteryNumber.Split(',');
                int[] unionLotto = Array.ConvertAll(segmentation, int.Parse);
                //1.是否输入了7个数
                //2.数字是否都是大于1小于33
                //3.是否有重复值
                if (unionLotto.Length != 7)
                {
                    Console.WriteLine("输入有误,请重新输入1");
                    continue;
                }
                for (int i = 0; i < unionLotto.Length; i++)
                {
                    if (unionLotto[i] < 1 || unionLotto[i] > 33)
                    {
                        Console.WriteLine("输入有误,请重新输入2");
                        unionLotto = null;
                        break;
                    }
                }
                if (unionLotto == null) continue;
                for (int i = 0; i < unionLotto.Length - 1; i++)
                {
                    for (int j = i + 1; j < unionLotto.Length; j++)
                    {
                        if (unionLotto[i] == unionLotto[j])
                        {
                            Console.WriteLine("有重复值,请重新输入");
                            unionLotto = null;
                            break;
                        }
                    }
                    if (unionLotto == null) break;
                }
                if (unionLotto == null) continue;
                else
                {
                    Console.WriteLine("这回肯定行");
                    return unionLotto;
                }
            } while (true);
        }

break

img



```c#
bool loop;
do {
loop=false;
if (unionLotto.Length < 7 || unionLotto.Length > 7)
                {
                    Console.WriteLine("输入有误,请重新输入1");
                   loop= true;
                 }
if (unionLotto[i] < 1 || unionLotto[i] > 33)
                        {
                            Console.WriteLine("输入有误,请重新输入2");
                   loop= true;
}
if (unionLotto[i] == unionLotto[j])
                        {
                            Console.WriteLine("有重复值,请重新输入");
                   loop= true;
}
}while(loop);

```