min_max
Finds min(0, max(100, x)), a clamp that is always one bound.
Category correctness, deny by default.
#import "Basic";
main :: () {
volume := 140;
volume = min(0, max(100, volume));
print("%\n", volume);
}error[min_max]: this is always `0`: the bounds are swapped
--> example.jai:5:14
|
5 | volume = min(0, max(100, volume));
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
help: to keep a value between 0 and 100, write `clamp(value, 0, 100)`
|
5 ~ volume = clamp(volume, 0, 100);
|
= note: `min_max` is `deny` by default#import "Basic";
main :: () {
volume := 140;
volume = min(100, max(0, volume));
print("%\n", volume);
}Literal bounds only, with procedures that select the smaller or larger argument (the library's min/max).