|
talith Novice
Joined: 03 Mar 2005 Posts: 31
|
Posted: Sun Sep 11, 2011 9:47 am
Checking a number range? |
I'm attempting to check a number against a range, and if true return a value. In python it would look like:
Code: |
if auraNumber == 1:
return 'one'
elif auraNumber in range(398,458):
return 'two'
elif auraNumber in range(458,524):
return 'three'
elif auraNumber in range(524,596):
return 'four' |
I just can't figure out a zmud equivalent method to do the above. Is this possible? |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Sun Sep 11, 2011 2:32 pm |
There's no built in in range function, you'd need to do something like
Code: |
#IF (@auraNumber >= 398 and @auraNumber <= 458) |
You could also make your own user-defined function:
Code: |
#VAR inrange {%if(%1 >= %2 and %1 <= %3,1,0)} |
then call it like this:
Code: |
#IF @inrange(@auraNumber, 398, 458) |
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Sep 11, 2011 5:36 pm |
There is no equivalent to the elif, either. Nest if commands.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|