Reputation: 676
Just a fast question:
I'm trying to test if a variable is not greater than or equal to another variable.
I have it coded as such:
if (f!>=i){
print ("True");}
but my c compiler won't recognize it. I can't find it online, is it possible?
Upvotes: 6
Views: 41506
Reputation: 33864
Just change it to (f < i)
which is !(f >= i)
.
Note: this is not the case if either f
or i
is NaN
. This is because f >= i
will evaluate to false
if either is NaN
leading to !(f >= i)
evaluating to true
where f < i
evaluates to false
.
Upvotes: 12
Reputation: 11
Use the aliter i.e instead of !>
think in reverse and use f<i
and you cant use ! for more than one operator i.e !+= is not valid
Upvotes: 1
Reputation: 39807
You want to do: if (!(f>=0))...
Specific to what you're doing, using <
makes more sense. My suggestion here is just for a generic means of reversing polarity on any if statement.
Upvotes: 5