Hi -
This is probably simple, so please forgive my ignorance. If I have a variable that is storing a number -
set theNum to 46
-how can I compare that to a range of numbers? For example, I want to test if 46 exists within a range from 30 to 50 . The range of numbers 30 through 50 exists in another variable. I’m guessing this list of numbers would look similar to the shortened version below.
set theList to (30, 31, 32, 33, 46, 50)
Would it be as simple as:
if theNum exists within theList then
--do something
end if
Is there a way to make my list more concise without having to spell out each number to check against?
set theNum to 46
set theList to {30, 31, 32, 33, 46, 50}
if theNum is in theList then --or if theList contains theNum then
return true
else
return false
end if
Any suggestions for making theList variable a little easier? Pretty sure I can’t do
set theList to (30 - 50)
because that would be a mathematical operation. Yet, visually, that’s how I’m inclined to think of a range of numbers. I just wondered if there’s something cleaner than just listing every number I want to check against.