在C语言中,有一个巧妙的技巧可以让您通过旋转来避免金字塔式代码:
if (check1())
if (check2())
if (check3())
do_something();
转入:
do {
if (!check1())
break;
if (!check2())
break;
if (!check3())
break;
do_something();
} while (0);
对于我来说,在Python中最干净的方法是什么,它没有do-while构造?
注意:我不一定要求在中实现do-while循环,而是一种避免前
我得到的信息是:
库存包含LCD分配器的不足项目,库存包含塔式分配器的不足项目
我希望传达的信息是:
库存包含液晶屏分配器、塔式分配器所需的不足物品
List<string> errors = new List<string>();
for (int index = 0; index < this.gridagree.Rows.Count; index++)
{
int productId = Convert.ToInt32(gridagree.Rows[index].Cells[3].Text);
string productna
我试图为塔式防御游戏创建一个外部弓箭手类,并拥有自己的平局函数,但我在从Archer类中访问图像函数时遇到了困难。我有一个解决办法,如下所示,但我觉得一定有更好的方法去做。
public class Sketch extends PApplet {
static PImage archerImg;
static Sketch s;
public void setup() {
s = this;
archerImg = loadImage("img/Archerv2.png");
}
}
class Archer {
public Arch