【发布时间】:2018-01-30 22:18:24
【问题描述】:
是否有与 Visual BASIC “with”概念等效的 Arduino?
如果我有和 Arduino 结构如下:
typedef struct {
int present = 0; // position now
int demand = 0; // required position
} superStruct;
superStruct super;
我可以说
if (super.present > super.demand) { super.present-=1; }
有什么方法可以把它缩短到
with super {
if (.present > .demand) { .present-=1; }
}
谢谢!
【问题讨论】:
-
您有什么顾虑?减少打字,还是别的什么?
-
易于阅读。减少打字是一个额外的好处。事实上,他们在 VB 中发明“WITH”时存在的所有顾虑。
-
不,没有。
-
想把它转换成答案吗?