I have a function which is being passed an integer value, representing a step value. There are 5 seperate conditions I want to test for: Value =0 Value =1 Value =-1 Value >1 Value <-1
Currently this is implemented as a set of if statements, and I would like to change this for a case statement. I have no problems with the specific value cases, or even a limited range (say 1..10) but how do i write a case representing Value >1 , or Value <-1?
var
MyValue: integer;
...
case MyValue of
Low(Integer)..-2:
beep;
-1:
beep;
0:
beep;
+1:
beep;
2..High(Integer):
beep;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With