有时需要在循环遍历完后再进行else操作,通常的办法是在循环前设置一个flag,用于判断。具体例子如下: 转载于:https://www.cnblogs.com/alphajuns/p/9789880.html