Getting a data range

You can write your topic however you want, but you need to answer these questions:

  1. I want to have a range of numbers. For ex: if number == 1250,3000

  2. I want to know how you can check from numbers 1250,3000

  3. I have looked on the dev fourm and still can’t find my answer.

Ex: if number == 1250 to 3000

The reason you don’t Find the answer anywhere is because it’s very simple.

Min <= Number <= Max should do the trick

if (number >= 1250 and number <= 3000) then

OMG, I remember. I feel dumb, thx for the help.

Wait what do you mean by number?

Is it not obvious? U even have it in your post

? He put number >= 1250 and number <= 3000 What is the number mean?

It’s the number you are comparing to the bounds of the rage. If a value number is between 1250 and 3000, then the boolean expressions number >= 1250 and number <= 3000 will both be true, therefore I combined both of those expressions with the and operator.

1 Like

You can just compare it individually, or use a NumberRange.

local range = NumberRange.new(1,100) 
local num = 10 

if num>range.Min and num<range.Max then 
   print("within bounds")
end