Perl中'for'和'foreach'有什么区别? [英] What's the difference between 'for' and 'foreach' in Perl?
本文介绍了Perl中'for'和'foreach'有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
没有区别。从 perldoc perlsyn :
< blockquote>
foreach
关键字实际上是关键字的同义词,所以您可以为简洁起见,请使用 foreach
或
I see these used interchangeably. What's the difference?
解决方案 There is no difference. From perldoc perlsyn:
The foreach
keyword is actually a synonym for the for
keyword, so you can use foreach
for readability or for
for brevity.
这篇关于Perl中'for'和'foreach'有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文