Jump to content

Case Statement


C Martin

Recommended Posts

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?

Link to comment

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

Link to comment

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.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...