If statements and && or ||

后端 未结 12 1319
臣服心动
臣服心动 2020-12-22 02:54

OK so I\'m a beginner with C# and I am having trouble understanding the if statement below.

For this example INumber is declared as 8, dPrice is 0 and dTAX is 10.

12条回答
  •  借酒劲吻你
    2020-12-22 03:40

    In English, this reads as: If iNumber is not 8 OR iNumber is not 9. iNumber is 8, which IS NOT 9 (your second check), so it drops into the if block.

    You're describing an AND condition where it doesn't equal 8 and it doesn't equal 9.

提交回复
热议问题