Anyone know a cleaner way to select on float ranges.
Hey @Krazay
You can create a Struct to store your options and ranges, and make an array to loop through and find the right montage if there’s one.

─
![]()
─

Then the logic to find the montage
─
This way you don’t have to stack up branches, you can just modify the struct array and it will work
2 Likes
If ranges do not overlap:
- create array of your float ranges (in ascending order)
- in for loop check if input value is >= than float from array
- if it is use for loop index as value to switch on
- use that with switch on int.
Or you can extend that with struct that holds two floats: min and max.
Basically you are seeking for first matching entry. Ie. InputValue is >= min and <= max from struct.
When you find it for loop index is your value to switch on int.
Then you can collapse whole thing into function, feed result to switch on int.
1 Like
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


