Upgrade expression switch function to allow expressions in the case statements, possibly in the form of "one sided" comparisons. The function would plug in the "switched value" for missing numeric terms preceding the following operators (>, >=, <, <=, =, !=, ), and (!, ^, %, *, /, +, -, &, |, xor, if followed by one of the earlier operators and another expression) in the case condition evaluation. The function should return the first true value.
I would expect the following example to return 'two'.
[code]switch(15.5,
5 && <10, //case 1
!=3, //case 2
0, // case 3
'one', //result 1
'two', //result 2
'three', //result 3
'none') //default
[/code]
This was prompted by the following example. Is there a better way using existing functions?
if({Root Container.Compass.Meter.value}>337.5, 'N',
if({Root Container.Compass.Meter.value}>292.5, 'NW',
if({Root Container.Compass.Meter.value}>247.5, 'W',
if({Root Container.Compass.Meter.value}>202.5, 'SW',
if({Root Container.Compass.Meter.value}>157.5, 'S',
if({Root Container.Compass.Meter.value}>112.5, 'SE',
if({Root Container.Compass.Meter.value}>67.5, 'E',
if({Root Container.Compass.Meter.value}>22.5, 'NE','N'))))))))