c# - checking if a number is even but not zero, in 1 condition? -
i don't think possible can done in 1 condition instead of 2?
i'm trying not this
bool test = (number1 & 1) == 0 && (number1 > 0); or this
bool test = (number1 & 1) == 0 && (number1 != 0);
will return true numbers >= 2 , false odd numbers, numbers <= 0:
bool test = ((number1 - 1) % 2 == 1);
Comments
Post a Comment