【发布时间】:2020-10-31 00:29:27
【问题描述】:
如何在循环而不是三元运算符中编写?
temp->status = (inStore ? waiting : called);
会是这样吗:
if (inStore){
return waiting;
}
else (
return called;
}
我不确定,因为这样做会出错,我在 void 函数中使用它
【问题讨论】:
-
if (inStore) temp->status = waiting; else temp->status = called;将等同于第一个代码。我看不出与循环有任何关系。