完全嵌套循环和不完全嵌套循环有什么区别? [英] What is the difference between perfectly nested loop and imperfectly nested loop?
本文介绍了完全嵌套循环和不完全嵌套循环有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道完美嵌套循环和不完美嵌套循环有什么区别?
I wanted to know what is the difference between perfectly nested loop and imperfectly nested loop?
推荐答案
请参见:完全嵌套循环是其中所有内容都在最内层循环中的循环.例如,
A perfectly nested loop is one wherein all content is in the innermost loop. For instance,
foreach(var a in vals1)
{
foreach (var b in vals2)
{
Console.WriteLine(a + b);
}
}
与嵌套不完善的嵌套相比,
As compared to an imperfectly nested one,
foreach(var a in vals1)
{
Console.WriteLine("values for " + a);
foreach (var b in vals2)
{
Console.WriteLine(a + b);
}
}
当然,我是C#专家,这是C#,我不认识的人都使用这样的术语,这一点都没有关系,但是您明白了这一点. 只要考虑一下在适当情况下编译的伪代码即可.
Of course, I'm a C# guy and this is C# where nobody I know of uses such terms and it doesn't matter at all, but you see the point. Just consider this pseudo-code that compiles under the right circumstances.
这篇关于完全嵌套循环和不完全嵌套循环有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文