If you take the time and effort to implement something CiccioCB, it obviously offers some worthwhile benefit even if that benefit is not immediately obvious to me... as with the additional CASE min TO max option.
Annex Help mentions the syntax, but doesn't explain how to use it, or give any usage limitations or constraints.
(eg: can it only be consecutive integers from min to max?)
It's just that I noticed it mentioned twice in the Change Log - "Implemented CASE min TO max" (Version 1.41 beta 3 and Version 1.39 beta 9) - and if you can be bothered to implement it, the best way to appreciate that is to know how to use it... so could you explain how to benefit from using CASE min TO max please ?
CASE min TO max
- Electroguard
- Posts: 852
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 273 times
- Been thanked: 321 times
-
- Posts: 142
- Joined: Mon Feb 08, 2021 10:10 pm
- Location: Scotland
- Has thanked: 46 times
- Been thanked: 50 times
Re: CASE min TO max
I requested this (back in December 2019) for this sort of use:-
Select case temperature
case 0 to 10 : tempcolour=blue
case 11 to 19: tempcolour=yellow
etc...
End select
Select case temperature
case 0 to 10 : tempcolour=blue
case 11 to 19: tempcolour=yellow
etc...
End select
- Electroguard
- Posts: 852
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 273 times
- Been thanked: 321 times
Re: CASE min TO max
Ah ok, so is used for groups of numbers, therefore presumably min and max need to be numeric.
- PeterN
- Posts: 383
- Joined: Mon Feb 08, 2021 7:56 pm
- Location: Krefeld, Germany
- Has thanked: 177 times
- Been thanked: 214 times
- Contact:
Re: CASE min TO max
I was happy to be able to use that in my CO2-Traffic-Light code:
Code: [Local Link Removed for Guests]
'######################################################################
SET_CO2_TRAFFIC_LIGHT:
SELECT CASE eCO2
CASE 300 to 500 : 'GREEN range
PIN(LED_GREEN) = 1 - PIN(LED_GREEN)
PIN(LED_RED) = 0
PIN(LED_YELLOW) = 0
CASE 501 to 700 : 'YELLOW range
PIN(LED_YELLOW) = 1 - PIN(LED_YELLOW)
PIN(LED_RED) = 0
PIN(LED_GREEN) = 0
CASE 701 to 9999 : 'RED range
PIN(LED_RED) = 0
pause 200
PIN(LED_RED) = 1 - PIN(LED_RED)
PIN(LED_GREEN) = 0
PIN(LED_YELLOW) = 0
CASE ELSE:
PIN(LED_RED) = 1
PIN(LED_YELLOW) = 1
PIN(LED_GREEN) = 1
END SELECT
return
'######################################################################
- Electroguard
- Posts: 852
- Joined: Mon Feb 08, 2021 6:22 pm
- Has thanked: 273 times
- Been thanked: 321 times
- cicciocb
- Site Admin
- Posts: 1978
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 425 times
- Been thanked: 1320 times
- Contact:
Re: CASE min TO max
Just for info, there is a little example in the documentation
[Local Link Removed for Guests]
[Local Link Removed for Guests]
Code: [Local Link Removed for Guests]
CASE 7 TO 10 : PRINT "case 7 to 10"