开发者

What condition can I use to check if a button tab is in a range?

开发者 https://www.devze.com 2023-03-18 18:27 出处:网络
I need to check if a button tab is between 91 and 96 inclusive. I don\'t want to write: if (button.tab==91) {

I need to check if a button tab is between 91 and 96 inclusive.

I don't want to write:

if (button.tab==91) {
    ...
}
if (button.tab==92) {
开发者_Python百科    ...
}
...

Instead, I want to use a single condition.

How can I do this?


if (button.tab >= 91 && button.tab <= 96)
{
    // do stuff!
}
0

精彩评论

暂无评论...
验证码 换一张
取 消