All my searches keep turning up irrelevant answers so I was wondering what is the fundamental problem with the question I am asking:
What is the operator in swift that means NOT Greater than " !> " ? Why doesn't this symbol exist?
edit: Just to clarify: I was trying to make an if statement in Swift where, if the value is not greater than or equal to 0, the value is obviously invalid, but I didn't want to specify a number range. I realized that else would probably catch what I was looking for:
if int >= 1 {
//do something
}else {
//number is not an integer greater than 1
//do something else
}
How about <=
? If x
is not greater than y
, then x <= y
. There's no need for a "not greater than" operator when it has the same meaning as "less than or equal to."
You can use:
if !(int > 1) {
// Do something...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With