How to check if an integer is in a given range?

前端 未结 18 1405
遥遥无期
遥遥无期 2020-11-27 03:58

Hoping for something more elegant than

if (i>0 && i<100) 
18条回答
  •  情话喂你
    2020-11-27 04:44

    That's how you check is an integer is in a range. Greater than the lower bound, less than the upper bound. Trying to be clever with subtraction will likely not do what you want.

提交回复
热议问题