D if or/and 语句如 python
D if or/and statement like python
D 有没有办法在 if 语句中表达 and/or?
if (1 > 2 or 3 < 5 and 1 == 1)
{
/* run code */
}
像这样。
Or 是 ||
并且 and 是 &&
,就像在 C、C++、Java、C# 和该家族的其他语言中一样:
if (1 > 2 || 3 < 5 && 1 == 1)
{
/* run code */
}
D 有没有办法在 if 语句中表达 and/or?
if (1 > 2 or 3 < 5 and 1 == 1)
{
/* run code */
}
像这样。
Or 是 ||
并且 and 是 &&
,就像在 C、C++、Java、C# 和该家族的其他语言中一样:
if (1 > 2 || 3 < 5 && 1 == 1)
{
/* run code */
}