循环遍历完成后再进行else判断

有时需要在循环遍历完后再进行else操作,通常的办法是在循环前设置一个flag,用于判断。具体例子如下:

原文地址:https://www.cnblogs.com/alphajuns/p/9789880.html