The number to check.
Optionalmin: numberThe minimum value of the range (inclusive). If undefined, only the max is checked.
Optionalmax: numberThe maximum value of the range (inclusive). If undefined, only the min is checked.
true if x is within the specified range, false otherwise.
Checks if a number
xis within a given range (inclusive). This function also serves as a type guard, narrowing the type tonumber.At least one of
minormaxmust be provided. Ifminhappens to be larger thanmax, it swaps them and works gracefully.