返回和break语句的区别 [英] Difference between Return and Break statements
本文介绍了返回和break语句的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何做一个返回
语句从破发
语句的不同?
如果我必须退出一个if条件,其中一个我应该preFER,返回
或破发
?
How does a return
statement differ from break
statement?.
If I have to exit an if condition, which one should I prefer, return
or break
?
推荐答案
突破被使用,而返回用于回它被称为或步骤停止进一步执行。
break is used when you want to exit from loop, while return is used to go back to the step where it was called or to stop further execution.
这篇关于返回和break语句的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文