C Martin Posted January 19, 2008 Posted January 19, 2008 Is there a possibility that we can get a Case Statement in our Programing Toolbox? It is much more powerful and flexible that the If statement. This is not in lieu of the If statement.
Mark Sanctuary Posted January 19, 2008 Posted January 19, 2008 I 2nd that request. It has mentioned before in the Events versus Procedures thread but, not in a dedicated request thread.
rowland Posted January 20, 2008 Posted January 20, 2008 Is there a possibility that we can get a Case Statement in our Programing Toolbox?It is much more powerful and flexible that the If statement. This is not in lieu of the If statement. The switch-case constructs that I'm familiar with are useful only if the language has variables. I'm assuming that this request is related to your other request for variables? Or, is there an example of a case statement that would be useful in the current ISY programming language without variables?
C Martin Posted January 20, 2008 Author Posted January 20, 2008 You are indeed correct - this would require the use of variables. Even if we didn't have a case statement, I think variables would still be a great addition.
Sub-Routine Posted January 20, 2008 Posted January 20, 2008 Don't you think of Status as a variable? True/False states are also variables, correct? And Time? If Time is 12:00:00PM Then Select Status 'MBRM' Case Off Set 'Fireplace' Off Case <30% Set 'Fireplace' Off Case On Set 'Fireplace' On EndSelect Else - No Actions - (To add one, press 'Action') Rand
rowland Posted January 20, 2008 Posted January 20, 2008 In this example, Status is more like a function than a variable. I.E., Status(MBRM) is evaluated and it is the return value that causes the appropriate branch to be taken. You wouldn't see an assignment like Status 'MBRM' = xxx. Nevertheless, your example illustrates that a switch-case construct would be useful even if ISY-speak doesn't have variables.
C Martin Posted January 20, 2008 Author Posted January 20, 2008 Rand, I could accept using the Status flag. I guess I didn't think about that, but I'm sure that I would have gotten around to it eventually. Good example. Clarence
Recommended Posts
Archived
This topic is now archived and is closed to further replies.