If-Statement checking vor a value between two others
Is there a kind of "between" check I can use in an if-s开发者_如何学运维tatement that verifies whether a given float value is between two others?
Can I write something like
if (floatConstA <= checkFloatValue < foatConstB) {
or must I do this using AND/OR constructs?
You have to do it with &&:
if (floatConstA <= checkFloatValue && checkFloatValue < foatConstB) {
You have to write it like 2 separate conditions, eg.
if((floatConstA <= checkFloatValue) && (checkFloatValue < floatConstB)) {
...
}
精彩评论