为什么在循环内继续是个坏主意? [英] Why is continue inside a loop a bad idea?

查看:85
本文介绍了为什么在循环内继续是个坏主意?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Douglas Crockfod说,通常最好在循环内重构continue.

Douglas Crockfod says that it is usually better to refactor the continue inside the loop.

为什么在循环内继续认为继续不好?

Why is continue considered bad within a loop?

推荐答案

使用continue意味着您在while中编写的条件不足.

The use of continue would mean that you have insufficient conditions written in your while.

您应该在while循环内使用if,或将条件添加到while循环中.

You should instead use if inside your while loop, or add the condition into the while loop.

这篇关于为什么在循环内继续是个坏主意?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆