# If var [not] between LowerBound and UpperBound

检测 variable's(变量) 内容是否在2个数字或字符串之间(包含边界)。

if Var between LowerBound and UpperBound
if Var not between LowerBound and UpperBound

#### 参数

Var | 待检测的 变量
LowerBound | 指定的范围下界, Var 必须大于或等于这个数字,字符串或变量引用
UpperBound | 指定的范围上界, Var 必须小于或等于这个数字,字符串或变量引用

#### 注意

如果这3个参数全为数字, 它们就会作为数字而非字符串进行比较。否则, 作为字符串进行比较 (也就是说, 字母字典序来决定 Var 是否在指定的范围之内)。在这种情况下, "StringCaseSense On" 可以用来设置是否区分大小写。

如下操作符 "between", "is", "in", 和 "contains" 不能用于 expressions(表达式) 中。

#### 相关命令

IfEqual/Greater/Less, if var in/contains MatchList, if var is type, IfInString, StringCaseSense, EnvAdd, Blocks, Else

#### 示例

    if var between 1 and 5
        MsgBox, %var% is in the range 1 to 5, inclusive.

    if var not between 0.0 and 1.0
        MsgBox %var% is not in the range 0.0 to 1.0, inclusive.

    if var between %VarLow% and %VarHigh%
        MsgBox %var% is between %VarLow% and %VarHigh%.

    if var between blue and red
        MsgBox %var% is alphabetically between the words blue and red.

    LowerLimit = 1
    UpperLimit = 10
    InputBox, UserInput, Enter a number between %LowerLimit% and %UpperLimit%
    if UserInput not between %LowerLimit% and %UpperLimit%
        MsgBox Your input is not within the valid range.